padOsd: Make label coordinates API "private"
This is only called internally, and only needed there. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1290
This commit is contained in:
parent
b0a12fee51
commit
ba435e5f2d
@ -348,14 +348,14 @@ var PadDiagram = GObject.registerClass({
|
|||||||
// FIXME: Fix num buttons.
|
// FIXME: Fix num buttons.
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (i = 0; i < 50; i++) {
|
for (i = 0; i < 50; i++) {
|
||||||
let [found] = this.getButtonLabelCoords(i);
|
let [found] = this._getLabelCoords(Meta.PadActionType.BUTTON, i);
|
||||||
if (!found)
|
if (!found)
|
||||||
break;
|
break;
|
||||||
this._addLabel(Meta.PadActionType.BUTTON, i);
|
this._addLabel(Meta.PadActionType.BUTTON, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
let [found] = this.getRingLabelCoords(i, CW);
|
let [found] = this._getLabelCoords(Meta.PadActionType.RING, i, CW);
|
||||||
if (!found)
|
if (!found)
|
||||||
break;
|
break;
|
||||||
this._addLabel(Meta.PadActionType.RING, i, CW);
|
this._addLabel(Meta.PadActionType.RING, i, CW);
|
||||||
@ -363,7 +363,7 @@ var PadDiagram = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
let [found] = this.getStripLabelCoords(i, UP);
|
let [found] = this._getLabelCoords(Meta.PadActionType.STRIP, i, UP);
|
||||||
if (!found)
|
if (!found)
|
||||||
break;
|
break;
|
||||||
this._addLabel(Meta.PadActionType.STRIP, i, UP);
|
this._addLabel(Meta.PadActionType.STRIP, i, UP);
|
||||||
@ -452,13 +452,13 @@ var PadDiagram = GObject.registerClass({
|
|||||||
|
|
||||||
for (let i = 0; i < this._labels.length; i++) {
|
for (let i = 0; i < this._labels.length; i++) {
|
||||||
let [label, action, idx, dir] = this._labels[i];
|
let [label, action, idx, dir] = this._labels[i];
|
||||||
let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
|
let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
|
||||||
this._allocateChild(label, x, y, arrangement);
|
this._allocateChild(label, x, y, arrangement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._editorActor && this._curEdited) {
|
if (this._editorActor && this._curEdited) {
|
||||||
let [label_, action, idx, dir] = this._curEdited;
|
let [label_, action, idx, dir] = this._curEdited;
|
||||||
let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
|
let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
|
||||||
this._allocateChild(this._editorActor, x, y, arrangement);
|
this._allocateChild(this._editorActor, x, y, arrangement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,39 +528,36 @@ var PadDiagram = GObject.registerClass({
|
|||||||
return [true, x, y, direction];
|
return [true, x, y, direction];
|
||||||
}
|
}
|
||||||
|
|
||||||
getButtonLabelCoords(button) {
|
_getButtonLabels(button) {
|
||||||
let ch = String.fromCharCode('A'.charCodeAt() + button);
|
let ch = String.fromCharCode('A'.charCodeAt() + button);
|
||||||
let labelName = 'Label%s'.format(ch);
|
let labelName = 'Label%s'.format(ch);
|
||||||
let leaderName = 'Leader%s'.format(ch);
|
let leaderName = 'Leader%s'.format(ch);
|
||||||
|
return [labelName, leaderName];
|
||||||
return this._getItemLabelCoords(labelName, leaderName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getRingLabelCoords(number, dir) {
|
_getRingLabels(number, dir) {
|
||||||
let numStr = number > 0 ? (number + 1).toString() : '';
|
let numStr = number > 0 ? (number + 1).toString() : '';
|
||||||
let dirStr = dir == CW ? 'CW' : 'CCW';
|
let dirStr = dir == CW ? 'CW' : 'CCW';
|
||||||
let labelName = 'LabelRing%s%s'.format(numStr, dirStr);
|
let labelName = 'LabelRing%s%s'.format(numStr, dirStr);
|
||||||
let leaderName = 'LeaderRing%s%s'.format(numStr, dirStr);
|
let leaderName = 'LeaderRing%s%s'.format(numStr, dirStr);
|
||||||
|
return [labelName, leaderName];
|
||||||
return this._getItemLabelCoords(labelName, leaderName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getStripLabelCoords(number, dir) {
|
_getStripLabels(number, dir) {
|
||||||
let numStr = number > 0 ? (number + 1).toString() : '';
|
let numStr = number > 0 ? (number + 1).toString() : '';
|
||||||
let dirStr = dir == UP ? 'Up' : 'Down';
|
let dirStr = dir == UP ? 'Up' : 'Down';
|
||||||
let labelName = 'LabelStrip%s%s'.format(numStr, dirStr);
|
let labelName = 'LabelStrip%s%s'.format(numStr, dirStr);
|
||||||
let leaderName = 'LeaderStrip%s%s'.format(numStr, dirStr);
|
let leaderName = 'LeaderStrip%s%s'.format(numStr, dirStr);
|
||||||
|
return [labelName, leaderName];
|
||||||
return this._getItemLabelCoords(labelName, leaderName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getLabelCoords(action, idx, dir) {
|
_getLabelCoords(action, idx, dir) {
|
||||||
if (action == Meta.PadActionType.BUTTON)
|
if (action == Meta.PadActionType.BUTTON)
|
||||||
return this.getButtonLabelCoords(idx);
|
return this._getItemLabelCoords(...this._getButtonLabels(idx));
|
||||||
else if (action == Meta.PadActionType.RING)
|
else if (action == Meta.PadActionType.RING)
|
||||||
return this.getRingLabelCoords(idx, dir);
|
return this._getItemLabelCoords(...this._getRingLabels(idx, dir));
|
||||||
else if (action == Meta.PadActionType.STRIP)
|
else if (action == Meta.PadActionType.STRIP)
|
||||||
return this.getStripLabelCoords(idx, dir);
|
return this._getItemLabelCoords(...this._getStripLabels(idx, dir));
|
||||||
|
|
||||||
return [false];
|
return [false];
|
||||||
}
|
}
|
||||||
@ -603,7 +600,7 @@ var PadDiagram = GObject.registerClass({
|
|||||||
if (str != null) {
|
if (str != null) {
|
||||||
label.set_text(str);
|
label.set_text(str);
|
||||||
|
|
||||||
let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
|
let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
|
||||||
this._allocateChild(label, x, y, arrangement);
|
this._allocateChild(label, x, y, arrangement);
|
||||||
}
|
}
|
||||||
label.show();
|
label.show();
|
||||||
@ -644,7 +641,7 @@ var PadDiagram = GObject.registerClass({
|
|||||||
|
|
||||||
if (this._curEdited == null)
|
if (this._curEdited == null)
|
||||||
return;
|
return;
|
||||||
let [found] = this.getLabelCoords(action, idx, dir);
|
let [found] = this._getLabelCoords(action, idx, dir);
|
||||||
if (!found)
|
if (!found)
|
||||||
return;
|
return;
|
||||||
this._editorActor.show();
|
this._editorActor.show();
|
||||||
|
Loading…
Reference in New Issue
Block a user