Settings fix

presentation
Andreas Butti 7 years ago
parent 0acf3e4675
commit beca3332c9
  1. 1510
      po/zh_HK.po
  2. 16
      src/control/settings/Settings.cpp
  3. 4
      src/control/settings/Settings.h
  4. 2
      src/gui/dialog/ButtonConfigGui.cpp
  5. 6
      src/gui/dialog/SettingsDialog.cpp
  6. 38
      src/util/DeviceListHelper.cpp
  7. 3
      src/util/DeviceListHelper.h
  8. 321
      ui/settings.glade

File diff suppressed because it is too large Load Diff

@ -18,7 +18,7 @@
#define WRITE_DOUBLE_PROP(var) xmlNode = savePropertyDouble((const char *)#var, var, root)
#define WRITE_COMMENT(var) com = xmlNewComment((const xmlChar *)var); xmlAddPrevSibling(xmlNode, com);
const char* BUTTON_NAMES[] = {"middle", "right", "eraser", "touch", "default", "stylus", "stylus2"};
const char* BUTTON_NAMES[] = {"middle", "right", "eraser", "touch", "default", "custom1", "custom2"};
Settings::Settings(path filename)
{
@ -97,9 +97,9 @@ void Settings::loadDefault()
this->buttonConfig[3] = new ButtonConfig(TOOL_NONE, 0, TOOL_SIZE_NONE, DRAWING_TYPE_NONE, ERASER_TYPE_NONE);
// Default config
this->buttonConfig[4] = new ButtonConfig(TOOL_PEN, 0, TOOL_SIZE_FINE, DRAWING_TYPE_NONE, ERASER_TYPE_NONE);
// Stylus button
// Custom 1
this->buttonConfig[5] = new ButtonConfig(TOOL_NONE, 0, TOOL_SIZE_NONE, DRAWING_TYPE_NONE, ERASER_TYPE_NONE);
// Stylus2 button
// Custom 2
this->buttonConfig[6] = new ButtonConfig(TOOL_NONE, 0, TOOL_SIZE_NONE, DRAWING_TYPE_NONE, ERASER_TYPE_NONE);
this->fullscreenHideElements = "mainMenubar";
@ -504,8 +504,8 @@ void Settings::loadButtonConfig()
}
}
// Touch device
if (i == 3)
// Touch device or Custom device
if (i == 3 || i >= 5)
{
if (!e.getString("device", cfg->device))
{
@ -703,7 +703,7 @@ void Settings::saveButtonConfig()
e.setBool("arrow", arrow);
e.setBool("shapeRecognizer", shapeRecognizer);
e.setString("size", toolSizeToString(cfg->size));
} // end if pen or hilighter
} // end if pen or highlighter
if (type == TOOL_PEN || type == TOOL_HILIGHTER || type == TOOL_TEXT)
{
@ -715,8 +715,8 @@ void Settings::saveButtonConfig()
e.setString("eraserMode", eraserTypeToString(cfg->eraserMode));
}
// Touch device
if (i == 3)
// Touch device or Custom device
if (i == 3 || i >= 5)
{
e.setString("device", cfg->device);
e.setBool("disableDrawing", cfg->disableDrawing);

@ -438,8 +438,8 @@ private:
* 2: right button
* 3: touch screen
* 4: default
* 5: Stylus button
* 6: Stylus2 button
* 5: Custom1
* 6: Custom2
*/
ButtonConfig* buttonConfig[BUTTON_COUNT];

@ -299,7 +299,7 @@ void ButtonConfigGui::saveSettings()
{
DeviceListHelper devList(cbDevice);
std::vector<InputDevice>& devices = devList.getDeviceList();
int dev = gtk_combo_box_get_active(GTK_COMBO_BOX(cbDevice));
int dev = gtk_combo_box_get_active(GTK_COMBO_BOX(cbDevice)) - 1;
if (dev < 0 || devices.size() <= dev)
{

@ -73,6 +73,8 @@ void SettingsDialog::initMouseButtonEvents()
initMouseButtonEvents("hboxRightMouse", 2);
initMouseButtonEvents("hboxEraser", 0);
initMouseButtonEvents("hboxTouch", 3, true);
initMouseButtonEvents("hboxCustom1", 5, true);
initMouseButtonEvents("hboxCustom2", 6, true);
initMouseButtonEvents("hboxDefault", 4);
}
@ -141,10 +143,6 @@ void SettingsDialog::toolboxToggled()
bool autosaveEnabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cbAutosave));
gtk_widget_set_sensitive(get("lbAutosaveTimeout"), autosaveEnabled);
gtk_widget_set_sensitive(get("spAutosaveTimeout"), autosaveEnabled);
// TODO set default correct and remove this lines
gtk_widget_set_sensitive(cbSettingPresureSensitivity, true);
gtk_widget_set_sensitive(labePresureSensitivity, true);
}
void SettingsDialog::load()

@ -15,18 +15,34 @@ DeviceListHelper::DeviceListHelper(GtkWidget* widget)
display = gtk_widget_get_display(widget);
}
// TODO For never GTK versions, see example here:
// https://cvs.gnucash.org/docs/MASTER/gnc-cell-renderer-popup_8c_source.html
GdkDeviceManager* deviceManager = gdk_display_get_device_manager(display);
GList* devList = gdk_device_manager_list_devices(deviceManager, GDK_DEVICE_TYPE_SLAVE);
addDevicesToList(gdk_device_manager_list_devices(deviceManager, GDK_DEVICE_TYPE_MASTER));
}
DeviceListHelper::~DeviceListHelper()
{
}
void DeviceListHelper::addDevicesToList(GList* devList)
{
// gdk_device_get_associated_device();
// For events: gdk_event_get_source_device();
while (devList != NULL)
{
deviceList.push_back(InputDevice((GdkDevice*) devList->data));
GdkDevice* dev = (GdkDevice*) devList->data;
deviceList.push_back(InputDevice(dev));
addDevicesToList(gdk_device_list_slave_devices(dev));
devList = devList->next;
}
}
DeviceListHelper::~DeviceListHelper()
{
g_list_free(devList);
}
std::vector<InputDevice>& DeviceListHelper::getDeviceList()
@ -75,6 +91,18 @@ string InputDevice::getType()
{
return _("cursor");
}
else if (source == GDK_SOURCE_KEYBOARD)
{
return _("keyboard");
}
else if (source == GDK_SOURCE_TOUCHSCREEN)
{
return _("touchscreen");
}
else if (source == GDK_SOURCE_TOUCHPAD)
{
return _("touchpad");
}
return "";
}

@ -45,6 +45,9 @@ public:
public:
std::vector<InputDevice>& getDeviceList();
private:
void addDevicesToList(GList* devList);
private:
std::vector<InputDevice> deviceList;
};

@ -74,6 +74,7 @@
<object class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_border">False</property>
<child>
<object class="GtkBox" id="box17">
<property name="visible">True</property>
@ -121,6 +122,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_top">5</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
@ -157,6 +159,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_top">5</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
@ -250,6 +253,7 @@ like to work on&lt;/i&gt;</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_top">5</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
@ -272,6 +276,7 @@ like to work on&lt;/i&gt;</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_top">5</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
@ -707,6 +712,8 @@ The units are cm for the ruler, dpi for the slider.&lt;/i&gt;</property>
<object class="GtkScale" id="zoomCallibSlider">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_top">20</property>
<property name="margin_bottom">20</property>
<property name="adjustment">adjustmentZoom</property>
<property name="round_digits">0</property>
<property name="digits">0</property>
@ -867,85 +874,171 @@ tool will be selected&lt;/i&gt;</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label17">
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;i&gt;Here you can define which tools will be selected If you
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box23">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;i&gt;Here you can define which tools will be selected If you
use the eraser or other device.
Here you can disable your touchscreen.&lt;/i&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Eraser&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hboxEraser">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label19">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Touch Screen&lt;/b&gt; &lt;i&gt;You can also configure other devices like mice&lt;/i&gt;</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hboxTouch">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Eraser&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hboxEraser">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label19">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Touch Screen&lt;/b&gt; &lt;i&gt;You can also configure other devices like mice&lt;/i&gt;</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hboxTouch">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Custom Device 1&lt;/b&gt; Additional Device Configuration</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hboxCustom1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label42">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Custom Device 2&lt;/b&gt; Additional Device Configuration</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hboxCustom2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">8</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">11</property>
</packing>
</child>
</object>
@ -1129,6 +1222,87 @@ Here you can disable your touchscreen.&lt;/i&gt;</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box19">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label41">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Scrollbars&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="xalign">0</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">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box21">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="vbox12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="cbHideHorizontalScrollbar">
<property name="label" translatable="yes">Hide the horizontal scrollbar</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>
<child>
<object class="GtkCheckButton" id="cbHideVerticalScrollbar">
<property name="label" translatable="yes">Hide the vertical scrollbar</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">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label13">
<property name="visible">True</property>
@ -1259,6 +1433,7 @@ Here you can disable your touchscreen.&lt;/i&gt;</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Select toolbar:</property>
</object>
@ -1269,13 +1444,13 @@ Here you can disable your touchscreen.&lt;/i&gt;</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="cbPresentationToolbar">
<object class="GtkComboBoxText" id="comboboxtext1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">1</property>
</packing>
</child>

Loading…
Cancel
Save