toggle -> switch

This commit is contained in:
abakkk 2020-08-06 00:04:12 +02:00
parent 1abe0b735f
commit 39ec1ba888
5 changed files with 62 additions and 62 deletions

24
area.js
View File

@ -324,7 +324,7 @@ var DrawingArea = new Lang.Class({
}
return Clutter.EVENT_STOP;
} else if (button == 2) {
this.toggleFill();
this.switchFill();
} else if (button == 3) {
this._stopDrawing();
this.menu.open(x, y);
@ -858,7 +858,7 @@ var DrawingArea = new Lang.Class({
}
},
toggleColor: function() {
switchColor: function() {
this.selectColor((this.currentColor == this.colors[1]) ? 2 : 1);
},
@ -878,12 +878,12 @@ var DrawingArea = new Lang.Class({
this.updatePointerCursor();
},
toggleFill: function() {
switchFill: function() {
this.fill = !this.fill;
this.emit('show-osd', null, this.fill ? _("Fill") : _("Outline"), "", -1, false);
},
toggleDash: function() {
switchDash: function() {
this.dashedLine = !this.dashedLine;
this.emit('show-osd', null, this.dashedLine ? _("Dashed line") : _("Full line"), "", -1, false);
},
@ -893,22 +893,22 @@ var DrawingArea = new Lang.Class({
this.emit('show-osd', null, _("%d px").format(this.currentLineWidth), "", 2 * this.currentLineWidth, false);
},
toggleLineJoin: function() {
switchLineJoin: function() {
this.currentLineJoin = this.currentLineJoin == 2 ? 0 : this.currentLineJoin + 1;
this.emit('show-osd', null, _(LineJoinNames[this.currentLineJoin]), "", -1, false);
},
toggleLineCap: function() {
switchLineCap: function() {
this.currentLineCap = this.currentLineCap == 2 ? 0 : this.currentLineCap + 1;
this.emit('show-osd', null, _(LineCapNames[this.currentLineCap]), "", -1, false);
},
toggleFillRule: function() {
switchFillRule: function() {
this.currentFillRule = this.currentFillRule == 1 ? 0 : this.currentFillRule + 1;
this.emit('show-osd', null, _(FillRuleNames[this.currentFillRule]), "", -1, false);
},
toggleFontWeight: function() {
switchFontWeight: function() {
let fontWeights = Object.keys(FontWeightNames).map(key => Number(key));
let index = fontWeights.indexOf(this.currentFontWeight);
this.currentFontWeight = index == fontWeights.length - 1 ? fontWeights[0] : fontWeights[index + 1];
@ -920,7 +920,7 @@ var DrawingArea = new Lang.Class({
`${_(FontWeightNames[this.currentFontWeight])}</span>`, "", -1, false);
},
toggleFontStyle: function() {
switchFontStyle: function() {
this.currentFontStyle = this.currentFontStyle == 2 ? 0 : this.currentFontStyle + 1;
if (this.currentElement && this.currentElement.font) {
this.currentElement.font.style = this.currentFontStyle;
@ -930,7 +930,7 @@ var DrawingArea = new Lang.Class({
`${_(FontStyleNames[this.currentFontStyle])}</span>`, "", -1, false);
},
toggleFontFamily: function() {
switchFontFamily: function() {
let index = Math.max(0, this.fontFamilies.indexOf(this.currentFontFamily));
this.currentFontFamily = (index == this.fontFamilies.length - 1) ? 0 : this.fontFamilies[index + 1];
if (this.currentElement && this.currentElement.font) {
@ -940,7 +940,7 @@ var DrawingArea = new Lang.Class({
this.emit('show-osd', null, `<span font_family="${this.currentFontFamily}">${_(this.currentFontFamily)}</span>`, "", -1, false);
},
toggleTextAlignment: function() {
switchTextAlignment: function() {
this.currentTextRightAligned = !this.currentTextRightAligned;
if (this.currentElement && this.currentElement.textRightAligned !== undefined) {
this.currentElement.textRightAligned = this.currentTextRightAligned;
@ -949,7 +949,7 @@ var DrawingArea = new Lang.Class({
this.emit('show-osd', null, this.currentTextRightAligned ? _("Right aligned") : _("Left aligned"), "", -1, false);
},
toggleImageFile: function() {
switchImageFile: function() {
let images = this.getImages();
if (!images.length)
return;

View File

@ -187,12 +187,12 @@ var AreaManager = new Lang.Class({
'decrement-line-width': () => this.activeArea.incrementLineWidth(-1),
'increment-line-width-more': () => this.activeArea.incrementLineWidth(5),
'decrement-line-width-more': () => this.activeArea.incrementLineWidth(-5),
'toggle-linejoin': this.activeArea.toggleLineJoin.bind(this.activeArea),
'toggle-linecap': this.activeArea.toggleLineCap.bind(this.activeArea),
'toggle-fill-rule': this.activeArea.toggleFillRule.bind(this.activeArea),
'toggle-dash' : this.activeArea.toggleDash.bind(this.activeArea),
'toggle-fill' : this.activeArea.toggleFill.bind(this.activeArea),
'toggle-image-file' : this.activeArea.toggleImageFile.bind(this.activeArea),
'switch-linejoin': this.activeArea.switchLineJoin.bind(this.activeArea),
'switch-linecap': this.activeArea.switchLineCap.bind(this.activeArea),
'switch-fill-rule': this.activeArea.switchFillRule.bind(this.activeArea),
'switch-dash' : this.activeArea.switchDash.bind(this.activeArea),
'switch-fill' : this.activeArea.switchFill.bind(this.activeArea),
'switch-image-file' : this.activeArea.switchImageFile.bind(this.activeArea),
'select-none-shape': () => this.activeArea.selectTool(Area.Tools.NONE),
'select-line-shape': () => this.activeArea.selectTool(Area.Tools.LINE),
'select-ellipse-shape': () => this.activeArea.selectTool(Area.Tools.ELLIPSE),
@ -215,10 +215,10 @@ var AreaManager = new Lang.Class({
'toggle-background': this.activeArea.toggleBackground.bind(this.activeArea),
'toggle-grid': this.activeArea.toggleGrid.bind(this.activeArea),
'toggle-square-area': this.activeArea.toggleSquareArea.bind(this.activeArea),
'toggle-font-family': this.activeArea.toggleFontFamily.bind(this.activeArea),
'toggle-font-weight': this.activeArea.toggleFontWeight.bind(this.activeArea),
'toggle-font-style': this.activeArea.toggleFontStyle.bind(this.activeArea),
'toggle-text-alignment': this.activeArea.toggleTextAlignment.bind(this.activeArea),
'switch-font-family': this.activeArea.switchFontFamily.bind(this.activeArea),
'switch-font-weight': this.activeArea.switchFontWeight.bind(this.activeArea),
'switch-font-style': this.activeArea.switchFontStyle.bind(this.activeArea),
'switch-text-alignment': this.activeArea.switchTextAlignment.bind(this.activeArea),
'toggle-panel-and-dock-visibility': this.togglePanelAndDockOpacity.bind(this),
'toggle-help': this.activeArea.toggleHelp.bind(this.activeArea),
'open-user-stylesheet': this.openUserStyleFile.bind(this),

View File

@ -59,22 +59,22 @@ var INTERNAL_KEYBINDINGS = {
'select-resize-tool': "Select resize",
'select-mirror-tool': "Select mirror",
'-separator-2': '',
'toggle-fill': "Toggle fill/outline",
'toggle-fill-rule': "Toggle fill rule",
'switch-fill': "Toggle fill/outline",
'switch-fill-rule': "Toggle fill rule",
'-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",
'toggle-linejoin': "Change linejoin",
'toggle-linecap': "Change linecap",
'toggle-dash': "Dashed line",
'switch-linejoin': "Change linejoin",
'switch-linecap': "Change linecap",
'switch-dash': "Dashed line",
'-separator-4': '',
'toggle-font-family': "Change font family (generic name)",
'toggle-font-weight': "Change font weight",
'toggle-font-style': "Change font style",
'toggle-text-alignment': "Toggle text alignment",
'toggle-image-file': "Change image file",
'switch-font-family': "Change font family (generic name)",
'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",

Binary file not shown.

View File

@ -151,30 +151,30 @@
<summary>decrement the line width even more</summary>
<description>decrement the line width even more</description>
</key>
<key type="as" name="toggle-linejoin">
<key type="as" name="switch-linejoin">
<default>["&lt;Primary&gt;j"]</default>
<summary>toggle linejoin</summary>
<description>toggle linejoin</description>
<summary>switch linejoin</summary>
<description>switch linejoin</description>
</key>
<key type="as" name="toggle-linecap">
<key type="as" name="switch-linecap">
<default>["&lt;Primary&gt;k"]</default>
<summary>toggle linecap</summary>
<description>toggle linecap</description>
<summary>switch linecap</summary>
<description>switch linecap</description>
</key>
<key type="as" name="toggle-fill-rule">
<key type="as" name="switch-fill-rule">
<default><![CDATA[['<Primary>KP_Multiply','<Primary>asterisk','<Primary><Shift>asterisk']]]></default>
<summary>toggle fill rule</summary>
<description>toggle fill rule</description>
<summary>switch fill rule</summary>
<description>switch fill rule</description>
</key>
<key type="as" name="toggle-dash">
<key type="as" name="switch-dash">
<default>["&lt;Primary&gt;period"]</default>
<summary>toggle dash</summary>
<description>toggle dash</description>
<summary>switch dash</summary>
<description>switch dash</description>
</key>
<key type="as" name="toggle-fill">
<key type="as" name="switch-fill">
<default>["&lt;Primary&gt;a"]</default>
<summary>toggle fill</summary>
<description>toggle fill</description>
<summary>switch fill</summary>
<description>switch fill</description>
</key>
<key type="as" name="select-color1">
<default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default>
@ -221,30 +221,30 @@
<summary>select color9</summary>
<description>select color9</description>
</key>
<key type="as" name="toggle-font-family">
<key type="as" name="switch-font-family">
<default>["&lt;Primary&gt;f"]</default>
<summary>toggle font family</summary>
<description>toggle font family</description>
<summary>switch font family</summary>
<description>switch font family</description>
</key>
<key type="as" name="toggle-font-weight">
<key type="as" name="switch-font-weight">
<default>["&lt;Primary&gt;w"]</default>
<summary>toggle font weight</summary>
<description>toggle font weight</description>
<summary>switch font weight</summary>
<description>switch font weight</description>
</key>
<key type="as" name="toggle-font-style">
<key type="as" name="switch-font-style">
<default>["&lt;Primary&gt;&lt;Shift&gt;w"]</default>
<summary>toggle font style</summary>
<description>toggle font style</description>
<summary>switch font style</summary>
<description>switch font style</description>
</key>
<key type="as" name="toggle-text-alignment">
<key type="as" name="switch-text-alignment">
<default>["&lt;Primary&gt;&lt;Shift&gt;a"]</default>
<summary>toggle text alignment</summary>
<description>toggle text alignment</description>
<summary>switch text alignment</summary>
<description>switch text alignment</description>
</key>
<key type="as" name="toggle-image-file">
<key type="as" name="switch-image-file">
<default>["&lt;Primary&gt;&lt;Shift&gt;i"]</default>
<summary>toggle image file</summary>
<description>toggle image file</description>
<summary>switch image file</summary>
<description>switch image file</description>
</key>
<key type="as" name="open-user-stylesheet">
<default>["&lt;Primary&gt;o"]</default>