rework prefs, settings, locales

Although there is a lot of changes, nothing is important.
This commit is contained in:
abakkk 2020-09-01 13:43:30 +02:00
parent 6a8afcc20a
commit c1689cac75
8 changed files with 501 additions and 531 deletions

View File

@ -223,7 +223,7 @@ var DrawingArea = new Lang.Class({
this.squareAreaSize = Math.max(64, Me.drawingSettings.get_uint('square-area-size'));
}
this.areaBackgroundColor = getClutterColorFromString(Me.drawingSettings.get_string('area-background-color'), 'BLACK');
this.areaBackgroundColor = getClutterColorFromString(Me.drawingSettings.get_string('background-color'), 'BLACK');
this.gridColor = getClutterColorFromString(Me.drawingSettings.get_string('grid-color'), 'GRAY');
if (Me.drawingSettings.get_boolean('grid-line-auto')) {

View File

@ -101,7 +101,7 @@ const AreaManager = new Lang.Class({
Shell.ActionMode.ALL,
this.toggleModal.bind(this));
Main.wm.addKeybinding('erase-drawing',
Main.wm.addKeybinding('erase-drawings',
Me.settings,
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.ALL,
@ -524,7 +524,7 @@ const AreaManager = new Lang.Class({
this.toggleDrawing();
Main.wm.removeKeybinding('toggle-drawing');
Main.wm.removeKeybinding('toggle-modal');
Main.wm.removeKeybinding('erase-drawing');
Main.wm.removeKeybinding('erase-drawings');
this.removeAreas();
if (this.indicator)
this.indicator.disable();

View File

@ -38,12 +38,7 @@ const GS_VERSION = Config.PACKAGE_VERSION;
const HELPER_ANIMATION_TIME = 0.25;
const MEDIA_KEYS_SCHEMA = 'org.gnome.settings-daemon.plugins.media-keys';
const MEDIA_KEYS_KEYS = {
'screenshot': "Screenshot",
'screenshot-clip': "Screenshot to clipboard",
'area-screenshot': "Area screenshot",
'area-screenshot-clip': "Area screenshot to clipboard"
};
const MEDIA_KEYS_KEYS = ['screenshot', 'screenshot-clip', 'area-screenshot', 'area-screenshot-clip'];
// DrawingHelper provides the "help osd" (Ctrl + F1)
// It uses the same texts as in prefs
@ -92,55 +87,58 @@ var DrawingHelper = new Lang.Class({
this.add_actor(this.vbox);
this.vbox.add_child(new St.Label({ text: _("Global") }));
for (let settingKey in Prefs.GLOBAL_KEYBINDINGS) {
let hbox = new St.BoxLayout({ vertical: false });
if (settingKey.indexOf('-separator-') != -1) {
this.vbox.add_child(hbox);
continue;
}
for (let settingKey of Prefs.GLOBAL_KEYBINDINGS) {
if (!Me.settings.get_strv(settingKey)[0])
continue;
let [keyval, mods] = Gtk.accelerator_parse(Me.settings.get_strv(settingKey)[0]);
hbox.add_child(new St.Label({ text: _(Prefs.GLOBAL_KEYBINDINGS[settingKey]) }));
hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true }));
this.vbox.add_child(hbox);
}
this.vbox.add_child(new St.Label({ text: _("Internal") }));
for (let i = 0; i < Prefs.OTHER_SHORTCUTS.length; i++) {
if (Prefs.OTHER_SHORTCUTS[i].desc.indexOf('-separator-') != -1) {
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
continue;
}
let hbox = new St.BoxLayout({ vertical: false });
hbox.add_child(new St.Label({ text: _(Prefs.OTHER_SHORTCUTS[i].desc) }));
hbox.add_child(new St.Label({ text: Prefs.OTHER_SHORTCUTS[i].shortcut, x_expand: true }));
hbox.get_children()[0].get_clutter_text().set_use_markup(true);
let [keyval, mods] = Gtk.accelerator_parse(Me.settings.get_strv(settingKey)[0]);
hbox.add_child(new St.Label({ text: Me.settings.settings_schema.get_key(settingKey).get_summary() }));
hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true }));
this.vbox.add_child(hbox);
}
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
this.vbox.add_child(new St.Label({ text: _("Internal") }));
for (let settingKey in Prefs.INTERNAL_KEYBINDINGS) {
if (settingKey.indexOf('-separator-') != -1) {
Prefs.OTHER_SHORTCUTS.forEach((object, index) => {
if (index)
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
continue;
for (let key in object) {
let hbox = new St.BoxLayout({ vertical: false });
hbox.add_child(new St.Label({ text: _(key) }));
hbox.add_child(new St.Label({ text: object[key], x_expand: true }));
hbox.get_children()[0].get_clutter_text().set_use_markup(true);
this.vbox.add_child(hbox);
}
let hbox = new St.BoxLayout({ vertical: false });
if (!Me.internalShortcutSettings.get_strv(settingKey)[0])
continue;
let [keyval, mods] = Gtk.accelerator_parse(Me.internalShortcutSettings.get_strv(settingKey)[0]);
hbox.add_child(new St.Label({ text: _(Prefs.INTERNAL_KEYBINDINGS[settingKey]) }));
hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true }));
this.vbox.add_child(hbox);
}
});
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
Prefs.INTERNAL_KEYBINDINGS.forEach((object, index) => {
if (index)
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
for (let settingKey of object) {
if (!Me.internalShortcutSettings.get_strv(settingKey)[0])
continue;
let hbox = new St.BoxLayout({ vertical: false });
let [keyval, mods] = Gtk.accelerator_parse(Me.internalShortcutSettings.get_strv(settingKey)[0]);
hbox.add_child(new St.Label({ text: Me.internalShortcutSettings.settings_schema.get_key(settingKey).get_summary() }));
hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true }));
this.vbox.add_child(hbox);
}
});
let mediaKeysSettings;
try { mediaKeysSettings = Convenience.getSettings(MEDIA_KEYS_SCHEMA); } catch(e) { return; }
this.vbox.add_child(new St.BoxLayout({ vertical: false, style_class: 'draw-on-your-screen-helper-separator' }));
this.vbox.add_child(new St.Label({ text: _("System") }));
for (let settingKey in MEDIA_KEYS_KEYS) {
for (let settingKey of MEDIA_KEYS_KEYS) {
if (!mediaKeysSettings.settings_schema.has_key(settingKey))
continue;
let shortcut = GS_VERSION < '3.33.0' ? mediaKeysSettings.get_string(settingKey) : mediaKeysSettings.get_strv(settingKey)[0];
@ -148,7 +146,7 @@ var DrawingHelper = new Lang.Class({
continue;
let [keyval, mods] = Gtk.accelerator_parse(shortcut);
let hbox = new St.BoxLayout({ vertical: false });
hbox.add_child(new St.Label({ text: _(MEDIA_KEYS_KEYS[settingKey]) }));
hbox.add_child(new St.Label({ text: mediaKeysSettings.settings_schema.get_key(settingKey).get_summary() }));
hbox.add_child(new St.Label({ text: Gtk.accelerator_get_label(keyval, mods), x_expand: true }));
this.vbox.add_child(hbox);
}

View File

@ -53,6 +53,9 @@ msgstr ""
msgid "Palettes"
msgstr ""
msgid "Color palettes"
msgstr ""
msgid "The palettes of drawing colors"
msgstr ""
@ -80,6 +83,9 @@ msgstr ""
msgid "Square area size"
msgstr ""
msgid "Automatic square area size"
msgstr ""
msgid "Compute the size of the square area from the screen size"
msgstr ""
@ -95,12 +101,21 @@ msgstr ""
msgid "Grid overlay line"
msgstr ""
msgid "Automatic grid overlay line"
msgstr ""
msgid "Compute the lengths from the screen size"
msgstr ""
msgid "Grid overlay line spacing"
msgstr ""
msgid "The line width in pixels"
msgstr ""
msgid "Grid overlay line width"
msgstr ""
msgid "The gap between lines in pixels"
msgstr ""
@ -116,12 +131,21 @@ msgstr ""
msgid "Dash array"
msgstr ""
msgid "Automatic dash array"
msgstr ""
msgid "Compute the lengths from the line width"
msgstr ""
msgid "Dash array on"
msgstr ""
msgid "The dash length in pixels"
msgstr ""
msgid "Dash array off"
msgstr ""
msgid "The gap between the dashes in pixels"
msgstr ""
@ -233,7 +257,7 @@ msgstr ""
msgid "Internal"
msgstr ""
msgid "(in drawing mode)"
msgid "In drawing mode"
msgstr ""
msgid "Undo last brushstroke"
@ -248,34 +272,61 @@ msgstr ""
msgid "Smooth last brushstroke"
msgstr ""
msgid "Select line"
msgid "Select color 1"
msgstr ""
msgid "Select ellipse"
msgid "Select color 2"
msgstr ""
msgid "Select rectangle"
msgid "Select color 3"
msgstr ""
msgid "Select polygon"
msgid "Select color 4"
msgstr ""
msgid "Select polyline"
msgid "Select color 5"
msgstr ""
msgid "Select image"
msgid "Select color 6"
msgstr ""
msgid "Select text"
msgid "Select color 7"
msgstr ""
msgid "Select move"
msgid "Select color 8"
msgstr ""
msgid "Select resize"
msgid "Select color 9"
msgstr ""
msgid "Select mirror"
msgid "Select ellipse tool"
msgstr ""
msgid "Select image tool"
msgstr ""
msgid "Select line tool"
msgstr ""
msgid "Select mirror tool"
msgstr ""
msgid "Select move tool"
msgstr ""
msgid "Select polygon tool"
msgstr ""
msgid "Select polyline tool"
msgstr ""
msgid "Select rectangle tool"
msgstr ""
msgid "Select resize tool"
msgstr ""
msgid "Select text tool"
msgstr ""
msgid "Toggle fill/outline"

26
menu.js
View File

@ -66,6 +66,10 @@ const getActor = function(object) {
return GS_VERSION < '3.33.0' ? object.actor : object;
};
const getSummary = function(settingKey) {
return Me.internalShortcutSettings.settings_schema.get_key(settingKey).get_summary();
};
var DrawingMenu = new Lang.Class({
Name: 'DrawOnYourScreenDrawingMenu',
@ -159,7 +163,7 @@ var DrawingMenu = new Lang.Class({
this.menu.removeAll();
this.actionButtons = [];
let groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: "draw-on-your-screen-menu-group-item" });
let groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: 'draw-on-your-screen-menu-group-item' });
getActor(groupItem).add_child(this._createActionButton(_("Undo"), this.area.undo.bind(this.area), 'edit-undo-symbolic'));
getActor(groupItem).add_child(this._createActionButton(_("Redo"), this.area.redo.bind(this.area), 'edit-redo-symbolic'));
getActor(groupItem).add_child(this._createActionButton(_("Erase"), this.area.deleteLastElement.bind(this.area), 'edit-clear-all-symbolic'));
@ -210,19 +214,19 @@ var DrawingMenu = new Lang.Class({
this.imageSection = imageSection;
let areaManager = Me.stateObj.areaManager;
this._addSimpleSwitchItem(this.menu, _("Hide panel and dock"), areaManager.hiddenList ? true : false, areaManager.togglePanelAndDockOpacity.bind(areaManager));
this._addSimpleSwitchItem(this.menu, _("Add a drawing background"), this.area.hasBackground, this.area.toggleBackground.bind(this.area));
this._addSimpleSwitchItem(this.menu, _("Add a grid overlay"), this.area.hasGrid, this.area.toggleGrid.bind(this.area));
this._addSimpleSwitchItem(this.menu, _("Square drawing area"), this.area.isSquareArea, this.area.toggleSquareArea.bind(this.area));
this._addSimpleSwitchItem(this.menu, getSummary('toggle-panel-and-dock-visibility'), !!areaManager.hiddenList, areaManager.togglePanelAndDockOpacity.bind(areaManager));
this._addSimpleSwitchItem(this.menu, getSummary('toggle-background'), this.area.hasBackground, this.area.toggleBackground.bind(this.area));
this._addSimpleSwitchItem(this.menu, getSummary('toggle-grid'), this.area.hasGrid, this.area.toggleGrid.bind(this.area));
this._addSimpleSwitchItem(this.menu, getSummary('toggle-square-area'), this.area.isSquareArea, this.area.toggleSquareArea.bind(this.area));
this._addSeparator(this.menu);
this._addDrawingNameItem(this.menu);
this._addOpenDrawingSubMenuItem(this.menu);
this._addSaveDrawingSubMenuItem(this.menu);
this.menu.addAction(_("Save drawing as a SVG file"), this.area.saveAsSvg.bind(this.area), 'image-x-generic-symbolic');
this.menu.addAction(_("Open preferences"), areaManager.openPreferences.bind(areaManager), 'document-page-setup-symbolic');
this.menu.addAction(_("Show help"), () => { this.close(); this.area.toggleHelp(); }, 'preferences-desktop-keyboard-shortcuts-symbolic');
this.menu.addAction(getSummary('save-as-svg'), this.area.saveAsSvg.bind(this.area), 'image-x-generic-symbolic');
this.menu.addAction(getSummary('open-preferences'), areaManager.openPreferences.bind(areaManager), 'document-page-setup-symbolic');
this.menu.addAction(getSummary('toggle-help'), () => { this.close(); this.area.toggleHelp(); }, 'preferences-desktop-keyboard-shortcuts-symbolic');
this._updateActionSensitivity();
this._updateSectionVisibility();
@ -308,7 +312,7 @@ var DrawingMenu = new Lang.Class({
if (GS_VERSION < '3.33.0') {
slider.connect('value-changed', (slider, value, property) => {
target[targetProperty] = Math.max(Math.round(value * 50), 0);
label.set_text(target[targetProperty] + " px");
label.set_text(_("%d px").format(target[targetProperty]));
if (target[targetProperty] === 0)
label.add_style_class_name(WARNING_COLOR_STYLE_CLASS_NAME);
else
@ -317,7 +321,7 @@ var DrawingMenu = new Lang.Class({
} else {
slider.connect('notify::value', () => {
target[targetProperty] = Math.max(Math.round(slider.value * 50), 0);
label.set_text(target[targetProperty] + " px");
label.set_text(_("%d px").format(target[targetProperty]));
if (target[targetProperty] === 0)
label.add_style_class_name(WARNING_COLOR_STYLE_CLASS_NAME);
else
@ -539,7 +543,7 @@ var DrawingMenu = new Lang.Class({
},
_addSaveDrawingSubMenuItem: function(menu) {
let item = new PopupMenu.PopupSubMenuMenuItem(_("Save drawing"), true);
let item = new PopupMenu.PopupSubMenuMenuItem(getSummary('save-as-json'), true);
this.saveDrawingSubMenuItem = item;
this._updateSaveDrawingSubMenuItemSensitivity();
this.saveDrawingSubMenu = item.menu;

375
prefs.js
View File

@ -21,6 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const Atk = imports.gi.Atk;
const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
@ -40,91 +41,48 @@ const _GTK = imports.gettext.domain('gtk30').gettext;
const GS_VERSION = Config.PACKAGE_VERSION;
const MARGIN = 10;
const ROWBOX_MARGIN_PARAMS = { margin_top: MARGIN / 2, margin_bottom: MARGIN / 2, margin_left: MARGIN, margin_right: MARGIN };
var GLOBAL_KEYBINDINGS = {
'toggle-drawing': "Enter/leave drawing mode",
'toggle-modal': "Grab/ungrab keyboard and pointer",
'erase-drawing': "Erase all drawings"
};
var GLOBAL_KEYBINDINGS = ['toggle-drawing', 'toggle-modal', 'erase-drawings'];
var INTERNAL_KEYBINDINGS = [
['undo', 'undo', 'delete-last-element', 'smooth-last-element'],
['select-none-shape', 'select-line-shape', 'select-ellipse-shape', 'select-rectangle-shape', 'select-polygon-shape', 'select-polyline-shape',
'select-text-shape', 'select-image-shape', 'select-move-tool', 'select-resize-tool', 'select-mirror-tool'],
['switch-fill', 'switch-fill-rule', 'switch-color-palette', 'switch-color-palette-reverse'],
['increment-line-width', 'decrement-line-width', 'increment-line-width-more', 'decrement-line-width-more',
'switch-linejoin', 'switch-linecap', 'switch-dash'],
['switch-font-family', 'switch-font-family-reverse', 'switch-font-weight', 'switch-font-style', 'switch-text-alignment', 'switch-image-file'],
['toggle-panel-and-dock-visibility', 'toggle-background', 'toggle-grid', 'toggle-square-area'],
['open-previous-json', 'open-next-json', 'save-as-json', 'save-as-svg', 'open-preferences', 'toggle-help']
];
var INTERNAL_KEYBINDINGS = {
'undo': "Undo last brushstroke",
'redo': "Redo last brushstroke",
'delete-last-element' : "Erase last brushstroke",
'smooth-last-element': "Smooth last brushstroke",
'-separator-1': '',
'select-none-shape': "Free drawing",
'select-line-shape': "Select line",
'select-ellipse-shape': "Select ellipse",
'select-rectangle-shape': "Select rectangle",
'select-polygon-shape': "Select polygon",
'select-polyline-shape': "Select polyline",
'select-text-shape': "Select text",
'select-image-shape': "Select image",
'select-move-tool': "Select move",
'select-resize-tool': "Select resize",
'select-mirror-tool': "Select mirror",
'-separator-2': '',
'switch-fill': "Toggle fill/outline",
'switch-fill-rule': "Toggle fill rule",
'switch-color-palette': "Change color palette",
'switch-color-palette-reverse': "Change color palette (reverse)",
'-separator-3': '',
'increment-line-width': "Increment line width",
'decrement-line-width': "Decrement line width",
'increment-line-width-more': "Increment line width even more",
'decrement-line-width-more': "Decrement line width even more",
'switch-linejoin': "Change linejoin",
'switch-linecap': "Change linecap",
'switch-dash': "Dashed line",
'-separator-4': '',
'switch-font-family': "Change font family",
'switch-font-family-reverse': "Change font family (reverse)",
'switch-font-weight': "Change font weight",
'switch-font-style': "Change font style",
'switch-text-alignment': "Toggle text alignment",
'switch-image-file': "Change image file",
'-separator-5': '',
'toggle-panel-and-dock-visibility': "Hide panel and dock",
'toggle-background': "Add a drawing background",
'toggle-grid': "Add a grid overlay",
'toggle-square-area': "Square drawing area",
'-separator-6': '',
'open-previous-json': "Open previous drawing",
'open-next-json': "Open next drawing",
'save-as-json': "Save drawing",
'save-as-svg': "Save drawing as a SVG file",
'open-preferences': "Open preferences",
'toggle-help': "Show help"
};
if (GS_VERSION < "3.36")
delete INTERNAL_KEYBINDINGS['open-preferences'];
if (GS_VERSION < '3.36')
delete INTERNAL_KEYBINDINGS[INTERNAL_KEYBINDINGS.length - 1]['open-preferences'];
const getKeyLabel = function(accel) {
let [keyval, mods] = Gtk.accelerator_parse(accel);
return Gtk.accelerator_get_label(keyval, mods);
};
var OTHER_SHORTCUTS = [
{ desc: "Draw", get shortcut() { return _("Left click"); } },
{ desc: "Menu", get shortcut() { return _("Right click"); } },
{ desc: "Toggle fill/outline", get shortcut() { return _("Center click"); } },
{ desc: "Increment/decrement line width", get shortcut() { return _("Scroll"); } },
{ desc: "Select color", get shortcut() { return _("%s … %s").format(getKeyLabel('<Primary>1'), getKeyLabel('<Primary>9')); } },
{ desc: "Ignore pointer movement", get shortcut() { return _("%s held").format(getKeyLabel('space')); } },
{ desc: "Leave", shortcut: getKeyLabel('Escape') },
{ desc: "-separator-1", shortcut: "" },
{ desc: "Select eraser <span alpha=\"50%\">(while starting drawing)</span>", shortcut: getKeyLabel('<Shift>') },
{ desc: "Duplicate <span alpha=\"50%\">(while starting handling)</span>", shortcut: getKeyLabel('<Shift>') },
{ desc: "Rotate rectangle, polygon, polyline", shortcut: getKeyLabel('<Primary>') },
{ desc: "Extend circle to ellipse", shortcut: getKeyLabel('<Primary>') },
{ desc: "Curve line", shortcut: getKeyLabel('<Primary>') },
{ desc: "Smooth free drawing outline", shortcut: getKeyLabel('<Primary>') },
{ desc: "Rotate <span alpha=\"50%\">(while moving)</span>", shortcut: getKeyLabel('<Primary>') },
{ desc: "Stretch <span alpha=\"50%\">(while resizing)</span>", shortcut: getKeyLabel('<Primary>') },
{ desc: "Inverse <span alpha=\"50%\">(while mirroring)</span>", shortcut: getKeyLabel('<Primary>') }
];
var OTHER_SHORTCUTS = [{
get "Draw"() { return _("Left click"); },
get "Menu"() { return _("Right click"); },
get "Toggle fill/outline"() { return _("Center click"); },
get "Increment/decrement line width"() { return _("Scroll"); },
get "Select color"() { return _("%s … %s").format(getKeyLabel('<Primary>1'), getKeyLabel('<Primary>9')); },
get "Ignore pointer movement"() { return _("%s held").format(getKeyLabel('space')); },
"Leave": getKeyLabel('Escape'),
}, {
"Select eraser <span alpha=\"50%\">(while starting drawing)</span>": getKeyLabel('<Shift>'),
"Duplicate <span alpha=\"50%\">(while starting handling)</span>": getKeyLabel('<Shift>'),
"Rotate rectangle, polygon, polyline": getKeyLabel('<Primary>'),
"Extend circle to ellipse": getKeyLabel('<Primary>'),
"Curve line": getKeyLabel('<Primary>'),
"Smooth free drawing outline": getKeyLabel('<Primary>'),
"Rotate <span alpha=\"50%\">(while moving)</span>": getKeyLabel('<Primary>'),
"Stretch <span alpha=\"50%\">(while resizing)</span>": getKeyLabel('<Primary>'),
"Inverse <span alpha=\"50%\">(while mirroring)</span>": getKeyLabel('<Primary>'),
}];
function init() {
Convenience.initTranslations();
@ -168,7 +126,7 @@ const AboutPage = new GObject.Class({
_init: function(params) {
this.parent({ hscrollbar_policy: Gtk.PolicyType.NEVER });
let vbox= new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN*3 });
let vbox= new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN * 3 });
this.add(vbox);
let name = "<b> " + _(Me.metadata.name) + "</b>";
@ -184,7 +142,7 @@ const AboutPage = new GObject.Class({
vbox.add(aboutLabel);
let creditBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin: 2*MARGIN });
let creditBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin: 2 * MARGIN });
let leftBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let rightBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let leftLabel = new Gtk.Label({ wrap: true, valign: 1, halign: 2, justify: 1, use_markup: true, label: "<small>" + _GTK("Created by") + "</small>" });
@ -218,42 +176,46 @@ const DrawingPage = new GObject.Class({
this.settings = Convenience.getSettings(Me.metadata['settings-schema'] + '.drawing');
this.schema = this.settings.settings_schema;
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN*3 });
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: 3 * MARGIN, spacing: 3 * MARGIN });
this.add(box);
let palettesFrame = new Gtk.Frame({ label_yalign: 1.0 });
palettesFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "<b><big>" + _("Palettes") + "</big></b>" }));
let palettesFrame = new Frame({ label: _("Palettes") });
box.add(palettesFrame);
let palettesScrolledWindow = new Gtk.ScrolledWindow({ vscrollbar_policy: Gtk.PolicyType.NEVER, margin_top: MARGIN/2, margin_bottom: MARGIN/2 });
let palettesScrolledWindow = new Gtk.ScrolledWindow({ vscrollbar_policy: Gtk.PolicyType.NEVER, margin_top: MARGIN / 2, margin_bottom: MARGIN / 2 });
palettesFrame.add(palettesScrolledWindow);
this.palettesListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true });
this.palettesListBox.get_style_context().add_class('background');
this.palettesListBox.get_accessible().set_name(this.schema.get_key('palettes').get_summary());
this.palettesListBox.get_accessible().set_description(this.schema.get_key('palettes').get_description());
palettesScrolledWindow.add(this.palettesListBox);
this.settings.connect('changed::palettes', this._updatePalettes.bind(this));
this._updatePalettes();
this.addBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN, tooltip_text: _("Add a new palette") });
this.addBox = new Gtk.Box(ROWBOX_MARGIN_PARAMS);
let addButton = Gtk.Button.new_from_icon_name('list-add-symbolic', Gtk.IconSize.BUTTON);
addButton.set_tooltip_text(_("Add a new palette"));
this.addBox.pack_start(addButton, true, true, 4);
addButton.connect('clicked', this._addNewPalette.bind(this));
this.palettesListBox.add(this.addBox);
this.addBox.get_parent().set_activatable(false);
let areaFrame = new Gtk.Frame({ margin_top: 3*MARGIN, label_yalign: 1.0 });
areaFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "<b><big>" + _("Area") + "</big></b>" }));
let areaFrame = new Frame({ label: _("Area") });
box.add(areaFrame);
let areaListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN/2, margin_bottom: MARGIN/2 });
let areaListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN / 2, margin_bottom: MARGIN / 2 });
areaListBox.get_style_context().add_class('background');
areaFrame.add(areaListBox);
let squareAreaRow = new PrefRow({ label: _("Square area size") });
let squareAreaAutoButton = new Gtk.CheckButton({ label: _("Auto"), tooltip_text: _(this.schema.get_key('square-area-auto').get_description()) });
let squareAreaRow = new PrefRow({ label: this.schema.get_key('square-area-size').get_summary() });
let squareAreaAutoButton = new Gtk.CheckButton({ label: _("Auto"),
name: this.schema.get_key('square-area-auto').get_summary(),
tooltip_text: this.schema.get_key('square-area-auto').get_description() });
let squareAreaSizeButton = new PixelSpinButton({ width_chars: 5, digits: 0,
adjustment: Gtk.Adjustment.new(0, 64, 32768, 1, 10, 0),
tooltip_text: _(this.schema.get_key('square-area-size').get_description()) });
name: this.schema.get_key('square-area-size').get_summary(),
tooltip_text: this.schema.get_key('square-area-size').get_description() });
this.settings.bind('square-area-auto', squareAreaAutoButton, 'active', 0);
this.settings.bind('square-area-size', squareAreaSizeButton, 'value', 0);
squareAreaAutoButton.bind_property('active', squareAreaSizeButton, 'sensitive', GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.INVERT_BOOLEAN);
@ -261,21 +223,26 @@ const DrawingPage = new GObject.Class({
squareAreaRow.addWidget(squareAreaSizeButton);
areaListBox.add(squareAreaRow);
let backgroundColorRow = new PrefRow({ label: _("Background color") });
let backgroundColorRow = new PrefRow({ label: this.schema.get_key('background-color').get_summary() });
let backgroundColorButton = new ColorStringButton({ use_alpha: true, show_editor: true,
tooltip_text: _(this.schema.get_key('area-background-color').get_description()) });
this.settings.bind('area-background-color', backgroundColorButton, 'color-string', 0);
name: this.schema.get_key('background-color').get_summary(),
tooltip_text: this.schema.get_key('background-color').get_description() });
this.settings.bind('background-color', backgroundColorButton, 'color-string', 0);
backgroundColorRow.addWidget(backgroundColorButton);
areaListBox.add(backgroundColorRow);
let gridLineRow = new PrefRow({ label: _("Grid overlay line") });
let gridLineAutoButton = new Gtk.CheckButton({ label: _("Auto"), tooltip_text: _(this.schema.get_key('grid-line-auto').get_description()) });
let gridLineAutoButton = new Gtk.CheckButton({ label: _("Auto"),
name: this.schema.get_key('grid-line-auto').get_summary(),
tooltip_text: this.schema.get_key('grid-line-auto').get_description() });
let gridLineWidthButton = new PixelSpinButton({ width_chars: 5, digits: 1,
adjustment: Gtk.Adjustment.new(0, 0.1, 10, 0.1, 1, 0),
tooltip_text: _(this.schema.get_key('grid-line-width').get_description()) });
adjustment: Gtk.Adjustment.new(0, 0.1, 10, 0.1, 1, 0),
name: this.schema.get_key('grid-line-width').get_summary(),
tooltip_text: this.schema.get_key('grid-line-width').get_description() });
let gridLineSpacingButton = new PixelSpinButton({ width_chars: 5, digits: 1,
adjustment: Gtk.Adjustment.new(0, 1, 16384, 1, 10, 0),
tooltip_text: _(this.schema.get_key('grid-line-spacing').get_description()) });
adjustment: Gtk.Adjustment.new(0, 1, 16384, 1, 10, 0),
name: this.schema.get_key('grid-line-spacing').get_summary(),
tooltip_text: this.schema.get_key('grid-line-spacing').get_description() });
this.settings.bind('grid-line-auto', gridLineAutoButton, 'active', 0);
this.settings.bind('grid-line-width', gridLineWidthButton, 'value', 0);
this.settings.bind('grid-line-spacing', gridLineSpacingButton, 'value', 0);
@ -286,29 +253,33 @@ const DrawingPage = new GObject.Class({
gridLineRow.addWidget(gridLineSpacingButton);
areaListBox.add(gridLineRow);
let gridColorRow = new PrefRow({ label: _("Grid overlay color") });
let gridColorRow = new PrefRow({ label: this.schema.get_key('grid-color').get_summary() });
let gridColorButton = new ColorStringButton({ use_alpha: true, show_editor: true,
tooltip_text: _(this.schema.get_key('grid-color').get_description()) });
name: this.schema.get_key('grid-color').get_summary(),
tooltip_text: this.schema.get_key('grid-color').get_description() });
this.settings.bind('grid-color', gridColorButton, 'color-string', 0);
gridColorRow.addWidget(gridColorButton);
areaListBox.add(gridColorRow);
let toolsFrame = new Gtk.Frame({ margin_top: 3*MARGIN, label_yalign: 1.0 });
toolsFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "<b><big>" + _("Tools") + "</big></b>" }));
let toolsFrame = new Frame({ label: _("Tools") });
box.add(toolsFrame);
let toolsListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN/2, margin_bottom: MARGIN/2 });
let toolsListBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN / 2, margin_bottom: MARGIN / 2 });
toolsListBox.get_style_context().add_class('background');
toolsFrame.add(toolsListBox);
let dashArrayRow = new PrefRow({ label: _("Dash array") });
let dashArrayAutoButton = new Gtk.CheckButton({ label: _("Auto"), tooltip_text: _(this.schema.get_key('dash-array-auto').get_description()) });
let dashArrayAutoButton = new Gtk.CheckButton({ label: _("Auto"),
name: this.schema.get_key('dash-array-auto').get_summary(),
tooltip_text: this.schema.get_key('dash-array-auto').get_description() });
let dashArrayOnButton = new PixelSpinButton({ width_chars: 5, digits: 1,
adjustment: Gtk.Adjustment.new(0, 0, 16384, 0.1, 1, 0),
tooltip_text: _(this.schema.get_key('dash-array-on').get_description()) });
name: this.schema.get_key('dash-array-on').get_summary(),
tooltip_text: this.schema.get_key('dash-array-on').get_description() });
let dashArrayOffButton = new PixelSpinButton({ width_chars: 5, digits: 1,
adjustment: Gtk.Adjustment.new(0, 0, 16384, 0.1, 1, 0),
tooltip_text: _(this.schema.get_key('dash-array-off').get_description()) });
name: this.schema.get_key('dash-array-off').get_summary(),
tooltip_text: this.schema.get_key('dash-array-off').get_description() });
this.settings.bind('dash-array-auto', dashArrayAutoButton, 'active', 0);
this.settings.bind('dash-array-on', dashArrayOnButton, 'value', 0);
this.settings.bind('dash-array-off', dashArrayOffButton, 'value', 0);
@ -319,10 +290,11 @@ const DrawingPage = new GObject.Class({
dashArrayRow.addWidget(dashArrayOffButton);
toolsListBox.add(dashArrayRow);
let dashOffsetRow = new PrefRow({ label: _("Dash offset") });
let dashOffsetRow = new PrefRow({ label: this.schema.get_key('dash-offset').get_summary() });
let dashOffsetButton = new PixelSpinButton({ width_chars: 5, digits: 1,
adjustment: Gtk.Adjustment.new(0, -16384, 16384, 0.1, 1, 0),
tooltip_text: _(this.schema.get_key('dash-offset').get_description()) });
name: this.schema.get_key('dash-offset').get_summary(),
tooltip_text: this.schema.get_key('dash-offset').get_description() });
this.settings.bind('dash-offset', dashOffsetButton, 'value', 0);
dashOffsetRow.addWidget(dashOffsetButton);
toolsListBox.add(dashOffsetRow);
@ -353,7 +325,7 @@ const DrawingPage = new GObject.Class({
let removeButton = Gtk.Button.new_from_icon_name('list-remove-symbolic', Gtk.IconSize.BUTTON);
removeButton.set_tooltip_text(_("Remove the palette"));
removeButton.connect('clicked', this._removePalette.bind(this, paletteIndex));
paletteBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
paletteBox = new Gtk.Box(ROWBOX_MARGIN_PARAMS);
paletteBox.pack_start(nameEntry, true, true, 4);
paletteBox.pack_start(new Gtk.Box({ spacing: 4 }), false, false, 4);
paletteBox.pack_start(removeButton, false, false, 4);
@ -416,108 +388,83 @@ const PrefsPage = new GObject.Class({
this.parent({ hscrollbar_policy: Gtk.PolicyType.NEVER });
let settings = Convenience.getSettings();
let schema = settings.settings_schema;
let internalShortcutSettings = Convenience.getSettings(Me.metadata['settings-schema'] + '.internal-shortcuts');
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN*3 });
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN * 3, spacing: 3 * MARGIN });
this.add(box);
let globalFrame = new Gtk.Frame({ label_yalign: 1.0 });
globalFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "<b><big>" + _("Global") + "</big></b>" }));
let globalFrame = new Frame({ label: _("Global") });
box.add(globalFrame);
let listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN/2, margin_bottom: MARGIN/2 });
let listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN / 2, margin_bottom: MARGIN / 2 });
listBox.get_style_context().add_class('background');
globalFrame.add(listBox);
let styleContext = listBox.get_style_context();
styleContext.add_class('background');
let globalKeybindingsRow = new Gtk.ListBoxRow({ activatable: false });
let globalKeybindingsWidget = new KeybindingsWidget(GLOBAL_KEYBINDINGS, settings);
globalKeybindingsWidget.margin = MARGIN;
listBox.add(globalKeybindingsWidget);
globalKeybindingsRow.add(globalKeybindingsWidget);
listBox.add(globalKeybindingsRow);
let persistentBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let persistentLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let persistentLabel1 = new Gtk.Label({label: _("Persistent")});
let persistentLabel2 = new Gtk.Label({ use_markup: true, halign: 1, wrap: true, xalign: 0, label: "<small>" + _("Persistent drawing through session restart") + "</small>" });
persistentLabel1.set_halign(1);
persistentLabel2.get_style_context().add_class('dim-label');
persistentLabelBox.pack_start(persistentLabel1, true, true, 0);
persistentLabelBox.pack_start(persistentLabel2, true, true, 0);
let persistentSwitch = new Gtk.Switch({valign: 3});
let persistentKey = schema.get_key('persistent-drawing');
let persistentRow = new PrefRow({ label: persistentKey.get_summary(), desc: persistentKey.get_description() });
let persistentSwitch = new Gtk.Switch();
settings.bind('persistent-drawing', persistentSwitch, 'active', 0);
persistentBox.pack_start(persistentLabelBox, true, true, 4);
persistentBox.pack_start(persistentSwitch, false, false, 4);
listBox.add(persistentBox);
persistentRow.addWidget(persistentSwitch, true);
listBox.add(persistentRow);
let desktopBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let desktopLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let desktopLabel1 = new Gtk.Label({label: _("Drawing on the desktop")});
let desktopLabel2 = new Gtk.Label({ use_markup: true, halign: 1, wrap: true, xalign: 0, label: "<small>" + _("<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>") + "</small>" });
desktopLabel1.set_halign(1);
desktopLabel2.get_style_context().add_class('dim-label');
desktopLabelBox.pack_start(desktopLabel1, true, true, 0);
desktopLabelBox.pack_start(desktopLabel2, true, true, 0);
let desktopSwitch = new Gtk.Switch({valign: 3});
let desktopKey = schema.get_key('drawing-on-desktop');
let desktopRow = new PrefRow({ label: desktopKey.get_summary(), desc: desktopKey.get_description() });
let desktopSwitch = new Gtk.Switch();
settings.bind('drawing-on-desktop', desktopSwitch, 'active', 0);
desktopBox.pack_start(desktopLabelBox, true, true, 4);
desktopBox.pack_start(desktopSwitch, false, false, 4);
listBox.add(desktopBox);
desktopRow.addWidget(desktopSwitch, true);
listBox.add(desktopRow);
let osdBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let osdLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let osdLabel1 = new Gtk.Label({label: _("Disable on-screen notifications")});
osdLabel1.set_halign(1);
osdLabelBox.pack_start(osdLabel1, true, true, 0);
let osdSwitch = new Gtk.Switch({valign: 3});
let osdKey = schema.get_key('osd-disabled');
let osdRow = new PrefRow({ label: osdKey.get_summary(), desc: osdKey.get_description() });
let osdSwitch = new Gtk.Switch();
settings.bind('osd-disabled', osdSwitch, 'active', 0);
osdBox.pack_start(osdLabelBox, true, true, 4);
osdBox.pack_start(osdSwitch, false, false, 4);
listBox.add(osdBox);
osdRow.addWidget(osdSwitch, true);
listBox.add(osdRow);
let indicatorBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let indicatorLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let indicatorLabel1 = new Gtk.Label({label: _("Disable panel indicator")});
indicatorLabel1.set_halign(1);
indicatorLabelBox.pack_start(indicatorLabel1, true, true, 0);
let indicatorSwitch = new Gtk.Switch({valign: 3});
let indicatorKey = schema.get_key('indicator-disabled');
let indicatorRow = new PrefRow({ label: indicatorKey.get_summary(), desc: indicatorKey.get_description() });
let indicatorSwitch = new Gtk.Switch();
settings.bind('indicator-disabled', indicatorSwitch, 'active', 0);
indicatorBox.pack_start(indicatorLabelBox, true, true, 4);
indicatorBox.pack_start(indicatorSwitch, false, false, 4);
listBox.add(indicatorBox);
indicatorRow.addWidget(indicatorSwitch, true);
listBox.add(indicatorRow);
let children = listBox.get_children();
for (let i = 0; i < children.length; i++) {
if (children[i].activatable)
children[i].set_activatable(false);
}
let internalFrame = new Gtk.Frame({ margin_top: 3*MARGIN, label_yalign: 1.0 });
internalFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "<b><big>" + _("Internal") + " </big></b>" + _("(in drawing mode)") }));
let internalFrame = new Frame({ label: _("Internal"), desc: _("In drawing mode") });
box.add(internalFrame);
listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN });
listBox.get_style_context().add_class('background');
internalFrame.add(listBox);
styleContext = listBox.get_style_context();
styleContext.add_class('background');
for (let i = 0; i < OTHER_SHORTCUTS.length; i++) {
if (OTHER_SHORTCUTS[i].desc.indexOf('-separator-') != -1) {
listBox.add(new Gtk.Box({ margin_top: MARGIN, margin_left: MARGIN, margin_right: MARGIN }));
continue;
OTHER_SHORTCUTS.forEach((object, index) => {
if (index)
listBox.add(new Gtk.Box(ROWBOX_MARGIN_PARAMS));
for (let key in object) {
let otherBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN });
let otherLabel = new Gtk.Label({ label: _(key), use_markup: true });
otherLabel.set_halign(1);
let otherLabel2 = new Gtk.Label({ label: object[key] });
otherBox.pack_start(otherLabel, true, true, 4);
otherBox.pack_start(otherLabel2, false, false, 4);
listBox.add(otherBox);
}
let otherBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN });
let otherLabel = new Gtk.Label({ label: _(OTHER_SHORTCUTS[i].desc), use_markup: true });
otherLabel.set_halign(1);
let otherLabel2 = new Gtk.Label({ label: OTHER_SHORTCUTS[i].shortcut });
otherBox.pack_start(otherLabel, true, true, 4);
otherBox.pack_start(otherLabel2, false, false, 4);
listBox.add(otherBox);
}
});
let internalKeybindingsWidget = new KeybindingsWidget(INTERNAL_KEYBINDINGS, internalShortcutSettings);
internalKeybindingsWidget.margin = MARGIN;
listBox.add(internalKeybindingsWidget);
listBox.add(new Gtk.Box(ROWBOX_MARGIN_PARAMS));
INTERNAL_KEYBINDINGS.forEach((array, index) => {
if (index)
listBox.add(new Gtk.Box(ROWBOX_MARGIN_PARAMS));
let internalKeybindingsWidget = new KeybindingsWidget(array, internalShortcutSettings);
listBox.add(internalKeybindingsWidget);
});
let noteBox = new Gtk.Box({ margin: MARGIN });
let noteLabel = new Gtk.Label({
@ -533,10 +480,22 @@ const PrefsPage = new GObject.Class({
noteBox.pack_start(noteLabel, true, true, 4);
listBox.add(noteBox);
children = listBox.get_children();
for (let i = 0; i < children.length; i++) {
if (children[i].activatable)
children[i].set_activatable(false);
listBox.get_children().forEach(row => row.set_activatable(false));
}
});
const Frame = new GObject.Class({
Name: 'DrawOnYourScreenFrame',
GTypeName: 'DrawOnYourScreenFrame',
Extends: Gtk.Frame,
_init: function(params) {
let labelWidget = new Gtk.Label({ margin_bottom: MARGIN / 2, use_markup: true, label: `<b><big>${params.label}</big></b>` });
this.parent({ label_yalign: 1.0, label_widget: labelWidget });
if (params.desc) {
labelWidget.set_tooltip_text(params.desc);
this.get_accessible().set_description(params.desc);
}
}
});
@ -549,7 +508,7 @@ const PrefRow = new GObject.Class({
_init: function(params) {
this.parent({ activatable: false });
let hbox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let hbox = new Gtk.Box(ROWBOX_MARGIN_PARAMS);
this.add(hbox);
let labelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
@ -558,17 +517,31 @@ const PrefRow = new GObject.Class({
this.widgetBox = new Gtk.Box({ spacing: 4 });
hbox.pack_start(this.widgetBox, false, false, 4);
labelBox.pack_start(new Gtk.Label({ use_markup: true, label: params.label, halign: Gtk.Align.START }), true, true, 0);
this.label = new Gtk.Label({ use_markup: true, label: params.label, halign: Gtk.Align.START });
labelBox.pack_start(this.label, true, true, 0);
if (params.desc) {
let desc = new Gtk.Label({ use_markup: true, label: `<small>${params.desc}</small>`, halign: Gtk.Align.START, wrap: true, xalign: 0 });
desc.get_style_context().add_class('dim-label');
labelBox.pack_start(desc, true, true, 0);
this.desc = new Gtk.Label({ use_markup: true, label: `<small>${params.desc}</small>`, halign: Gtk.Align.START, wrap: true, xalign: 0 });
this.desc.get_style_context().add_class('dim-label');
labelBox.pack_start(this.desc, true, true, 0);
this.widgetBox.set_valign(Gtk.Align.START);
}
},
addWidget: function(widget) {
addWidget: function(widget, setRelationship) {
this.widgetBox.add(widget);
if (widget.name)
widget.get_accessible().set_name(widget.name);
if (setRelationship) {
this.label.get_accessible().add_relationship(Atk.RelationType.LABEL_FOR, widget.get_accessible());
widget.get_accessible().add_relationship(Atk.RelationType.LABELLED_BY, this.label.get_accessible());
if (this.desc) {
this.desc.get_accessible().add_relationship(Atk.RelationType.DESCRIPTION_FOR, widget.get_accessible());
widget.get_accessible().add_relationship(Atk.RelationType.DESCRIBED_BY, this.desc.get_accessible());
}
}
}
});
@ -579,7 +552,7 @@ const PixelSpinButton = new GObject.Class({
// Add 'px' unit.
vfunc_output: function() {
this.text = `${Math.round(this.value * 100) / 100} px`;
this.text = _("%d px").format(Math.round(this.value * 100) / 100);
return true;
},
@ -631,7 +604,7 @@ const KeybindingsWidget = new GObject.Class({
Extends: Gtk.Box,
_init: function(keybindings, settings) {
this.parent();
this.parent(ROWBOX_MARGIN_PARAMS);
this.set_orientation(Gtk.Orientation.VERTICAL);
this._keybindings = keybindings;
@ -721,9 +694,7 @@ const KeybindingsWidget = new GObject.Class({
_refresh: function() {
this._store.clear();
for(let settings_key in this._keybindings) {
if (settings_key.indexOf('-separator-') != -1)
continue;
for(let settings_key of this._keybindings) {
let [key, mods] = Gtk.accelerator_parse(
this._settings.get_strv(settings_key)[0]
);
@ -738,7 +709,7 @@ const KeybindingsWidget = new GObject.Class({
],
[
settings_key,
_(this._keybindings[settings_key]),
this._settings.settings_schema.get_key(settings_key).get_summary(),
mods,
key
]

Binary file not shown.

View File

@ -1,305 +1,251 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="gnome-shell-extensions">
<schemalist gettext-domain="draw-on-your-screen">
<schema path="/org/gnome/shell/extensions/draw-on-your-screen/" id="org.gnome.shell.extensions.draw-on-your-screen">
<child name="drawing" schema="org.gnome.shell.extensions.draw-on-your-screen.drawing"/>
<child name="internal-shortcuts" schema="org.gnome.shell.extensions.draw-on-your-screen.internal-shortcuts"/>
<key type="b" name="drawing-on-desktop">
<default>false</default>
<summary>move drawing on desktop</summary>
<description>move drawing on desktop</description>
<summary>Drawing on the desktop</summary>
<description><![CDATA[<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>]]></description>
</key>
<key type="b" name="persistent-drawing">
<default>false</default>
<summary>persistent drawing</summary>
<description>persistent drawing</description>
</key>
<key type="b" name="osd-disabled">
<default>false</default>
<summary>disable OSD notifications</summary>
<description>disable on-screen notifications</description>
<key type="as" name="erase-drawings">
<default>["&lt;Alt&gt;&lt;Super&gt;e"]</default>
<summary>Erase all drawings</summary>
</key>
<key type="b" name="indicator-disabled">
<default>false</default>
<summary>disable panel indicator</summary>
<description>disable panel indicator</description>
<summary>Disable panel indicator</summary>
</key>
<key type="b" name="osd-disabled">
<default>false</default>
<summary>Disable on-screen notifications</summary>
</key>
<key type="b" name="persistent-drawing">
<default>false</default>
<summary>Persistent</summary>
<description>Persistent drawing through session restart</description>
</key>
<key type="as" name="toggle-drawing">
<default>["&lt;Alt&gt;&lt;Super&gt;d"]</default>
<summary>toggle drawing</summary>
<description>enter or leave drawing mode</description>
<summary>Enter/leave drawing mode</summary>
</key>
<key type="as" name="toggle-modal">
<default>["&lt;Primary&gt;&lt;Alt&gt;&lt;Super&gt;d"]</default>
<summary>toggle modeless/modal</summary>
<description>toggle modeless/modal</description>
<summary>Grab/ungrab keyboard and pointer</summary>
<description></description>
</key>
<key type="as" name="erase-drawing">
<default>["&lt;Alt&gt;&lt;Super&gt;e"]</default>
<summary>erase drawing</summary>
<description>erase drawing</description>
</key>
<child name="internal-shortcuts" schema="org.gnome.shell.extensions.draw-on-your-screen.internal-shortcuts"/>
<child name="drawing" schema="org.gnome.shell.extensions.draw-on-your-screen.drawing"/>
</schema>
<schema path="/org/gnome/shell/extensions/draw-on-your-screen/internal-shortcuts/" id="org.gnome.shell.extensions.draw-on-your-screen.internal-shortcuts">
<key type="as" name="undo">
<default>["&lt;Primary&gt;z"]</default>
<summary>undo</summary>
<description>undo</description>
</key>
<key type="as" name="redo">
<default>["&lt;Primary&gt;&lt;Shift&gt;z"]</default>
<summary>redo</summary>
<description>redo</description>
</key>
<key type="as" name="delete-last-element">
<default>["Delete"]</default>
<summary>delete last element</summary>
<description>delete last element</description>
</key>
<key type="as" name="smooth-last-element">
<default>["&lt;Primary&gt;equal"]</default>
<summary>smooth last brushstroke</summary>
<description>smooth last brushstroke</description>
</key>
<key type="as" name="toggle-background">
<default>["&lt;Primary&gt;b"]</default>
<summary>toggle drawing background</summary>
<description>toggle drawing background</description>
</key>
<key type="as" name="toggle-grid">
<default>["&lt;Primary&gt;g"]</default>
<summary>toggle grid overlay</summary>
<description>toggle grid overlay</description>
</key>
<key type="as" name="toggle-panel-and-dock-visibility">
<default>["&lt;Primary&gt;h"]</default>
<summary>hide or show panel and dock</summary>
<description>hide or show panel and dock</description>
</key>
<key type="as" name="toggle-square-area">
<default>["&lt;Primary&gt;n"]</default>
<summary>toggle square area</summary>
<description>toggle square area</description>
</key>
<key type="as" name="select-ellipse-shape">
<default>["&lt;Primary&gt;e"]</default>
<summary>select cercle</summary>
<description>select a cercle</description>
</key>
<key type="as" name="select-rectangle-shape">
<default>["&lt;Primary&gt;r"]</default>
<summary>select rectangle</summary>
<description>select rectangle</description>
</key>
<key type="as" name="select-polygon-shape">
<default>["&lt;Primary&gt;y"]</default>
<summary>select polygon</summary>
<description>select polygon</description>
</key>
<key type="as" name="select-polyline-shape">
<default>["&lt;Primary&gt;u"]</default>
<summary>select polyline</summary>
<description>select polyline</description>
</key>
<key type="as" name="select-line-shape">
<default>["&lt;Primary&gt;l"]</default>
<summary>select line</summary>
<description>select a line</description>
</key>
<key type="as" name="select-text-shape">
<default>["&lt;Primary&gt;t"]</default>
<summary>select text</summary>
<description>select text</description>
</key>
<key type="as" name="select-image-shape">
<default>["&lt;Primary&gt;i"]</default>
<summary>select image</summary>
<description>select image</description>
</key>
<key type="as" name="select-none-shape">
<default>["&lt;Primary&gt;p"]</default>
<summary>unselect shape (free drawing)</summary>
<description>unselect shape (free drawing)</description>
</key>
<key type="as" name="select-move-tool">
<default>["&lt;Primary&gt;m"]</default>
<summary>select move tool</summary>
<description>select move tool</description>
</key>
<key type="as" name="select-resize-tool">
<default>["&lt;Primary&gt;x"]</default>
<summary>select resize tool</summary>
<description>select resize tool</description>
</key>
<key type="as" name="select-mirror-tool">
<default>["&lt;Primary&gt;c"]</default>
<summary>select mirror tool</summary>
<description>select mirror tool</description>
</key>
<key type="as" name="increment-line-width">
<default><![CDATA[['<Primary>KP_Add','<Primary><Shift>plus']]]></default>
<summary>increment the line width</summary>
<description>increment the line width</description>
</key>
<key type="as" name="decrement-line-width">
<default><![CDATA[['<Primary>KP_Subtract','<Primary>minus','<Primary><Shift>minus']]]></default>
<summary>decrement the line width</summary>
<description>decrement the line width</description>
</key>
<key type="as" name="increment-line-width-more">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Add"]</default>
<summary>increment the line width even more</summary>
<description>increment the line width even more</description>
<summary>Decrement line width</summary>
</key>
<key type="as" name="decrement-line-width-more">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Subtract"]</default>
<summary>decrement the line width even more</summary>
<description>decrement the line width even more</description>
<summary>Decrement line width even more</summary>
</key>
<key type="as" name="switch-linejoin">
<default>["&lt;Primary&gt;j"]</default>
<summary>switch linejoin</summary>
<description>switch linejoin</description>
<key type="as" name="delete-last-element">
<default>["Delete"]</default>
<summary>Erase last brushstroke</summary>
</key>
<key type="as" name="switch-linecap">
<default>["&lt;Primary&gt;k"]</default>
<summary>switch linecap</summary>
<description>switch linecap</description>
<key type="as" name="increment-line-width">
<default><![CDATA[['<Primary>KP_Add','<Primary><Shift>plus']]]></default>
<summary>Increment line width</summary>
</key>
<key type="as" name="switch-fill-rule">
<default><![CDATA[['<Primary>KP_Multiply','<Primary>asterisk','<Primary><Shift>asterisk']]]></default>
<summary>switch fill rule</summary>
<description>switch fill rule</description>
</key>
<key type="as" name="switch-dash">
<default>["&lt;Primary&gt;period"]</default>
<summary>switch dash</summary>
<description>switch dash</description>
</key>
<key type="as" name="switch-fill">
<default>["&lt;Primary&gt;a"]</default>
<summary>switch fill</summary>
<description>switch fill</description>
</key>
<key type="as" name="select-color1">
<default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default>
<summary>select color1</summary>
<description>select color1</description>
</key>
<key type="as" name="select-color2">
<default><![CDATA[['<Primary>KP_2','<Primary>2']]]></default>
<summary>select color2</summary>
<description>select color2</description>
</key>
<key type="as" name="select-color3">
<default><![CDATA[['<Primary>KP_3','<Primary>3']]]></default>
<summary>select color3</summary>
<description>select color3</description>
</key>
<key type="as" name="select-color4">
<default><![CDATA[['<Primary>KP_4','<Primary>4']]]></default>
<summary>select color4</summary>
<description>select color4</description>
</key>
<key type="as" name="select-color5">
<default><![CDATA[['<Primary>KP_5','<Primary>5']]]></default>
<summary>select color5</summary>
<description>select color5</description>
</key>
<key type="as" name="select-color6">
<default><![CDATA[['<Primary>KP_6','<Primary>6']]]></default>
<summary>select color6</summary>
<description>select color6</description>
</key>
<key type="as" name="select-color7">
<default><![CDATA[['<Primary>KP_7','<Primary>7']]]></default>
<summary>select color7</summary>
<description>select color7</description>
</key>
<key type="as" name="select-color8">
<default><![CDATA[['<Primary>KP_8','<Primary>8']]]></default>
<summary>select color8</summary>
<description>select color8</description>
</key>
<key type="as" name="select-color9">
<default><![CDATA[['<Primary>KP_9','<Primary>9']]]></default>
<summary>select color9</summary>
<description>select color9</description>
</key>
<key type="as" name="switch-font-family">
<default>["&lt;Primary&gt;f"]</default>
<summary>switch font family</summary>
<description>switch font family</description>
</key>
<key type="as" name="switch-font-family-reverse">
<default>["&lt;Primary&gt;&lt;Shift&gt;f"]</default>
<summary>switch font family (reverse)</summary>
<description>switch font family (reverse)</description>
</key>
<key type="as" name="switch-font-weight">
<default>["&lt;Primary&gt;w"]</default>
<summary>switch font weight</summary>
<description>switch font weight</description>
</key>
<key type="as" name="switch-font-style">
<default>["&lt;Primary&gt;&lt;Shift&gt;w"]</default>
<summary>switch font style</summary>
<description>switch font style</description>
</key>
<key type="as" name="switch-color-palette">
<default>["&lt;Primary&gt;KP_Divide","&lt;Primary&gt;slash"]</default>
<summary>switch color palette</summary>
<description>switch color palette</description>
</key>
<key type="as" name="switch-color-palette-reverse">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Divide","&lt;Primary&gt;&lt;Shift&gt;slash"]</default>
<summary>switch color palette (reverse)</summary>
<description>switch color palette (reverse)</description>
</key>
<key type="as" name="switch-text-alignment">
<default>["&lt;Primary&gt;&lt;Shift&gt;a"]</default>
<summary>switch text alignment</summary>
<description>switch text alignment</description>
</key>
<key type="as" name="switch-image-file">
<default>["&lt;Primary&gt;&lt;Shift&gt;i"]</default>
<summary>switch image file</summary>
<description>switch image file</description>
</key>
<key type="as" name="save-as-svg">
<default>["&lt;Primary&gt;&lt;Shift&gt;s"]</default>
<summary>Save drawing as a svg file</summary>
<description>Save drawing as a svg file</description>
</key>
<key type="as" name="save-as-json">
<default>["&lt;Primary&gt;s"]</default>
<summary>Save drawing as a json file</summary>
<description>Save drawing as a json file</description>
</key>
<key type="as" name="open-previous-json">
<default>["&lt;Primary&gt;&lt;Shift&gt;o"]</default>
<summary>Open previous json file</summary>
<description>Open previous json file</description>
<key type="as" name="increment-line-width-more">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Add"]</default>
<summary>Increment line width even more</summary>
</key>
<key type="as" name="open-next-json">
<default>["&lt;Primary&gt;o"]</default>
<summary>Open next json file</summary>
<description>Open next json file</description>
<summary>Open next drawing</summary>
</key>
<key type="as" name="open-preferences">
<default>["&lt;Primary&gt;comma"]</default>
<summary>Open preferences</summary>
<description>Open preferences</description>
</key>
<key type="as" name="open-previous-json">
<default>["&lt;Primary&gt;&lt;Shift&gt;o"]</default>
<summary>Open previous drawing</summary>
</key>
<key type="as" name="redo">
<default>["&lt;Primary&gt;&lt;Shift&gt;z"]</default>
<summary>Redo last brushstroke</summary>
</key>
<key type="as" name="save-as-json">
<default>["&lt;Primary&gt;s"]</default>
<summary>Save drawing</summary>
</key>
<key type="as" name="save-as-svg">
<default>["&lt;Primary&gt;&lt;Shift&gt;s"]</default>
<summary>Save drawing as a SVG file</summary>
</key>
<key type="as" name="select-color1">
<default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default>
<summary>Select color 1</summary>
<description></description>
</key>
<key type="as" name="select-color2">
<default><![CDATA[['<Primary>KP_2','<Primary>2']]]></default>
<summary>Select color 2</summary>
</key>
<key type="as" name="select-color3">
<default><![CDATA[['<Primary>KP_3','<Primary>3']]]></default>
<summary>Select color 3</summary>
</key>
<key type="as" name="select-color4">
<default><![CDATA[['<Primary>KP_4','<Primary>4']]]></default>
<summary>Select color 4</summary>
</key>
<key type="as" name="select-color5">
<default><![CDATA[['<Primary>KP_5','<Primary>5']]]></default>
<summary>Select color 5</summary>
</key>
<key type="as" name="select-color6">
<default><![CDATA[['<Primary>KP_6','<Primary>6']]]></default>
<summary>Select color 6</summary>
</key>
<key type="as" name="select-color7">
<default><![CDATA[['<Primary>KP_7','<Primary>7']]]></default>
<summary>Select color 7</summary>
</key>
<key type="as" name="select-color8">
<default><![CDATA[['<Primary>KP_8','<Primary>8']]]></default>
<summary>Select color 8</summary>
</key>
<key type="as" name="select-color9">
<default><![CDATA[['<Primary>KP_9','<Primary>9']]]></default>
<summary>Select color 9</summary>
</key>
<key type="as" name="select-ellipse-shape">
<default>["&lt;Primary&gt;e"]</default>
<summary>Select ellipse tool</summary>
</key>
<key type="as" name="select-image-shape">
<default>["&lt;Primary&gt;i"]</default>
<summary>Select image tool</summary>
</key>
<key type="as" name="select-line-shape">
<default>["&lt;Primary&gt;l"]</default>
<summary>Select line tool</summary>
</key>
<key type="as" name="select-mirror-tool">
<default>["&lt;Primary&gt;c"]</default>
<summary>Select mirror tool</summary>
</key>
<key type="as" name="select-move-tool">
<default>["&lt;Primary&gt;m"]</default>
<summary>Select move tool</summary>
</key>
<key type="as" name="select-none-shape">
<default>["&lt;Primary&gt;p"]</default>
<summary>Free drawing</summary>
</key>
<key type="as" name="select-polygon-shape">
<default>["&lt;Primary&gt;y"]</default>
<summary>Select polygon tool</summary>
</key>
<key type="as" name="select-polyline-shape">
<default>["&lt;Primary&gt;u"]</default>
<summary>Select polyline tool</summary>
</key>
<key type="as" name="select-rectangle-shape">
<default>["&lt;Primary&gt;r"]</default>
<summary>Select rectangle tool</summary>
</key>
<key type="as" name="select-resize-tool">
<default>["&lt;Primary&gt;x"]</default>
<summary>Select resize tool</summary>
</key>
<key type="as" name="select-text-shape">
<default>["&lt;Primary&gt;t"]</default>
<summary>Select text tool</summary>
</key>
<key type="as" name="smooth-last-element">
<default>["&lt;Primary&gt;equal"]</default>
<summary>Smooth last brushstroke</summary>
</key>
<key type="as" name="switch-color-palette">
<default>["&lt;Primary&gt;KP_Divide","&lt;Primary&gt;slash"]</default>
<summary>Change color palette</summary>
</key>
<key type="as" name="switch-color-palette-reverse">
<default>["&lt;Primary&gt;&lt;Shift&gt;KP_Divide","&lt;Primary&gt;&lt;Shift&gt;slash"]</default>
<summary>Change color palette (reverse)</summary>
</key>
<key type="as" name="switch-dash">
<default>["&lt;Primary&gt;period"]</default>
<summary>Dashed line</summary>
</key>
<key type="as" name="switch-fill">
<default>["&lt;Primary&gt;a"]</default>
<summary>Toggle fill/outline</summary>
</key>
<key type="as" name="switch-fill-rule">
<default><![CDATA[['<Primary>KP_Multiply','<Primary>asterisk','<Primary><Shift>asterisk']]]></default>
<summary>Toggle fill rule</summary>
</key>
<key type="as" name="switch-font-family">
<default>["&lt;Primary&gt;f"]</default>
<summary>Change font family</summary>
</key>
<key type="as" name="switch-font-family-reverse">
<default>["&lt;Primary&gt;&lt;Shift&gt;f"]</default>
<summary>Change font family (reverse)</summary>
</key>
<key type="as" name="switch-font-style">
<default>["&lt;Primary&gt;&lt;Shift&gt;w"]</default>
<summary>Change font style</summary>
</key>
<key type="as" name="switch-font-weight">
<default>["&lt;Primary&gt;w"]</default>
<summary>Change font weight</summary>
</key>
<key type="as" name="switch-image-file">
<default>["&lt;Primary&gt;&lt;Shift&gt;i"]</default>
<summary>Change image file</summary>
</key>
<key type="as" name="switch-linecap">
<default>["&lt;Primary&gt;k"]</default>
<summary>Change linecap</summary>
</key>
<key type="as" name="switch-linejoin">
<default>["&lt;Primary&gt;j"]</default>
<summary>Change linejoin</summary>
</key>
<key type="as" name="switch-text-alignment">
<default>["&lt;Primary&gt;&lt;Shift&gt;a"]</default>
<summary>Toggle text alignment</summary>
</key>
<key type="as" name="toggle-background">
<default>["&lt;Primary&gt;b"]</default>
<summary>Add a drawing background</summary>
</key>
<key type="as" name="toggle-grid">
<default>["&lt;Primary&gt;g"]</default>
<summary>Add a grid overlay</summary>
</key>
<key type="as" name="toggle-help">
<default>["&lt;Primary&gt;F1"]</default>
<summary>toggle help</summary>
<description>toggle help</description>
<summary>Show help</summary>
</key>
<key type="as" name="toggle-panel-and-dock-visibility">
<default>["&lt;Primary&gt;h"]</default>
<summary>Hide panel and dock</summary>
</key>
<key type="as" name="toggle-square-area">
<default>["&lt;Primary&gt;n"]</default>
<summary>Square drawing area</summary>
</key>
<key type="as" name="undo">
<default>["&lt;Primary&gt;z"]</default>
<summary>Undo last brushstroke</summary>
</key>
</schema>
<schema path="/org/gnome/shell/extensions/draw-on-your-screen/drawing/" id="org.gnome.shell.extensions.draw-on-your-screen.drawing">
<key type="s" name="area-background-color">
<key type="s" name="background-color">
<default>"#2e2e2e"</default>
<summary>Drawing area background color</summary>
<summary>Background color</summary>
<description>The color of the drawing area background</description>
</key>
<key type="b" name="dash-array-auto">