Merge pull request #801 from luco5826/master

Highlight cursor position - added
presentation
Luca Errani 7 years ago committed by GitHub
commit b616af8742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 711
      po/cs.po
  2. 724
      po/de.po
  3. 725
      po/it.po
  4. 711
      po/pl.po
  5. 703
      po/xournalpp.pot
  6. 711
      po/zh.po
  7. 711
      po/zh_HK.po
  8. 711
      po/zh_TW.po
  9. 27
      src/control/settings/Settings.cpp
  10. 8
      src/control/settings/Settings.h
  11. 41
      src/gui/Cursor.cpp
  12. 2
      src/gui/dialog/SettingsDialog.cpp
  13. 15
      ui/settings.glade

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -68,6 +68,7 @@ void Settings::loadDefault()
this->autoloadPdfXoj = true;
this->showBigCursor = false;
this->highlightPosition = false;
this->darkTheme = false;
this->scrollbarHideType = SCROLLBAR_HIDE_NONE;
@ -336,6 +337,10 @@ void Settings::parseItem(xmlDocPtr doc, xmlNodePtr cur)
{
this->showBigCursor = xmlStrcmp(value, (const xmlChar*) "true") ? false : true;
}
else if (xmlStrcmp(name, (const xmlChar*) "highlightPosition") == 0)
{
this->highlightPosition = xmlStrcmp(value, (const xmlChar*) "true") ? false : true;
}
else if (xmlStrcmp(name, (const xmlChar*) "darkTheme") == 0)
{
this->darkTheme = xmlStrcmp(value, (const xmlChar*) "true") ? false : true;
@ -725,6 +730,7 @@ void Settings::save()
WRITE_COMMENT("Which gui elements are hidden if you are in Presentation mode, separated by a colon (,)");
WRITE_BOOL_PROP(showBigCursor);
WRITE_BOOL_PROP(highlightPosition);
WRITE_BOOL_PROP(darkTheme);
if (this->scrollbarHideType == SCROLLBAR_HIDE_BOTH)
@ -1042,6 +1048,27 @@ void Settings::setShowBigCursor(bool b)
save();
}
bool Settings::isHighlightPosition()
{
XOJ_CHECK_TYPE(Settings);
return this->highlightPosition;
}
void Settings::setHighlightPosition(bool highlight)
{
XOJ_CHECK_TYPE(Settings);
if (this->highlightPosition == highlight)
{
return;
}
this->highlightPosition = highlight;
save();
}
bool Settings::isSnapRotation()
{
XOJ_CHECK_TYPE(Settings);

@ -251,6 +251,9 @@ public:
bool isShowBigCursor();
void setShowBigCursor(bool b);
bool isHighlightPosition();
void setHighlightPosition(bool highlight);
ScrollbarHideType getScrollbarHideType();
void setScrollbarHideType(ScrollbarHideType type);
@ -388,6 +391,11 @@ private:
*/
bool showBigCursor;
/**
* Show a yellow circle around the cursor
*/
bool highlightPosition;
/**
* If the user uses a dark-themed DE, he should enable this
* (white icons)

@ -323,15 +323,21 @@ GdkCursor* Cursor::createHighlighterOrPenCursor(int size, double alpha)
double b = (rgb & 0xff) / 255.0;
bool big = control->getSettings()->isShowBigCursor();
bool highlightPosition = control->getSettings()->isHighlightPosition();
int height = size;
int width = size;
if (big)
{
height = 22;
width = 22;
height = width = 100;
}
// We change the drawing method, now the center with the colored dot of the pen
// is at the center of the cairo surface, and when we load the cursor, we load it
// with the relative offset
int centerX = width / 2;
int centerY = height / 2;
cairo_surface_t* crCursor = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
cairo_t* cr = cairo_create(crCursor);
@ -358,24 +364,37 @@ GdkCursor* Cursor::createHighlighterOrPenCursor(int size, double alpha)
// cairo_line_to(cr, 13, 14);
// Color dot
cairo_move_to(cr, 2, 19);
// Starting point
cairo_move_to(cr, centerX + 2, centerY);
// Pencil cursor
cairo_line_to(cr, 2, 15);
cairo_line_to(cr, 15, 0.5);
cairo_line_to(cr, 19, 4);
cairo_line_to(cr, 6, 19);
cairo_line_to(cr, centerX + 2, centerY - 4);
cairo_line_to(cr, centerX + 15, centerY - 17.5);
cairo_line_to(cr, centerX + 19, centerY - 14);
cairo_line_to(cr, centerX + 6, centerY );
cairo_close_path(cr);
cairo_fill_preserve(cr);
cairo_set_source_rgb(cr, 0, 0, 0);
cairo_stroke(cr);
if(highlightPosition)
{
// A yellow transparent circle with no border
cairo_set_line_width(cr, 0);
cairo_set_source_rgba(cr, 255, 255, 0, 0.5);
cairo_arc(cr, centerX, centerY, 45, 0, 2 * 3.1415);
}
cairo_fill_preserve(cr);
cairo_set_source_rgb(cr, 0, 0, 0);
cairo_stroke(cr);
}
cairo_set_source_rgba(cr, r, g, b, alpha);
// Correct the offset of the coloured dot for big-cursor mode
cairo_rectangle(cr, 0, big ? height-size : 0, size, size);
cairo_rectangle(cr, centerX, centerY, size, size);
cairo_fill(cr);
cairo_destroy(cr);
@ -388,7 +407,7 @@ GdkCursor* Cursor::createHighlighterOrPenCursor(int size, double alpha)
cairo_surface_destroy(crCursor);
GdkCursor* cursor = gdk_cursor_new_from_pixbuf(
gtk_widget_get_display(control->getWindow()->getXournal()->getWidget()), pixbuf, 1, height-size);
gtk_widget_get_display(control->getWindow()->getXournal()->getWidget()), pixbuf, centerX, centerY);
g_object_unref(pixbuf);

@ -164,6 +164,7 @@ void SettingsDialog::load()
loadCheckbox("cbAddVerticalSpace", settings->getAddVerticalSpace());
loadCheckbox("cbAddHorizontalSpace", settings->getAddHorizontalSpace());
loadCheckbox("cbBigCursor", settings->isShowBigCursor());
loadCheckbox("cbHighlightPosition", settings->isHighlightPosition());
loadCheckbox("cbDarkTheme", settings->isDarkTheme());
loadCheckbox("cbHideHorizontalScrollbar", settings->getScrollbarHideType() & SCROLLBAR_HIDE_HORIZONTAL);
loadCheckbox("cbHideVerticalScrollbar", settings->getScrollbarHideType() & SCROLLBAR_HIDE_VERTICAL);
@ -344,6 +345,7 @@ void SettingsDialog::save()
settings->setAddVerticalSpace(getCheckbox("cbAddVerticalSpace"));
settings->setAddHorizontalSpace(getCheckbox("cbAddHorizontalSpace"));
settings->setShowBigCursor(getCheckbox("cbBigCursor"));
settings->setHighlightPosition(getCheckbox("cbHighlightPosition"));
settings->setDarkTheme(getCheckbox("cbDarkTheme"));
settings->setTouchWorkaround(getCheckbox("cbTouchWorkaround"));

@ -1939,6 +1939,21 @@ they are not blocking!&lt;/i&gt;</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cbHighlightPosition">
<property name="label" translatable="yes">Highlight cursor position</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>

Loading…
Cancel
Save