Skip to content

Commit

Permalink
Add option to change button layout (fixes #152)
Browse files Browse the repository at this point in the history
  • Loading branch information
RiotPharaoh authored and cxw42 committed Dec 18, 2018
1 parent 16f849a commit 3ac0f27
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 27 deletions.
4 changes: 4 additions & 0 deletions app/common/setting-definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ _NAM.CFG_POPUP_ON_STARTUP = 'open-popup-on-chrome-startup';
_DEF[_NAM.CFG_POPUP_ON_STARTUP] = true;
_VAL[_NAM.CFG_POPUP_ON_STARTUP] = _vbool;

_NAM.CFG_FLIP_BUTTONS = 'flip-buttons';
_DEF[_NAM.CFG_FLIP_BUTTONS] = false;
_VAL[_NAM.CFG_FLIP_BUTTONS] = _vbool;

_NAM.CFG_ENB_CONTEXT_MENU = 'ContextMenu.Enabled';
_DEF[_NAM.CFG_ENB_CONTEXT_MENU] = true;
_VAL[_NAM.CFG_ENB_CONTEXT_MENU] = _vbool;
Expand Down
13 changes: 13 additions & 0 deletions app/settings/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,19 @@ bar (it will start with "file://")</li>
"type": "checkbox",
"label": future_i18n("Show page title in each item's tooltip"),
},
{
"tab": future_i18n("Appearance"),
"group": future_i18n("Tabs Edit Management"),
"name": CFG_FLIP_BUTTONS,
"type": "checkbox",
"label": future_i18n("Enable collocation of buttons for managing Tabs <br>" + " Close and Save " + saveImg + " Edit " + editImg + " Delete " + delImg + "<br><br>"),
},
{
"tab": future_i18n("Appearance"),
"group": future_i18n("Tabs Edit Management"),
"type": "description",
"text": future_i18n("<b>Default Buttons Layout</b><br>" + " Edit " + editImg + " Close and Save " + saveImg + "Delete " + delImg),
},

// Features
{
Expand Down
72 changes: 45 additions & 27 deletions app/win/main_tl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1263,36 +1263,54 @@ function addWindowNodeActions(win_node_id)
class: K.ACTION_GROUP_WIN_CLASS // + ' jstree-animated' //TODO?
});

T.treeobj.add_action(win_node_id, {
id: 'renameWindow',
class: 'fff-pencil ' + K.ACTION_BUTTON_WIN_CLASS,
text: '\xa0',
grouped: true,
title: _T('ttEditWin'),
callback: actionRenameWindow,
dataset: { action: 'renameWindow' }
});
// Set a button management layout choosed by user.
// If checkbox in "Enable Optional" in "Appearance" in "Options" is unchecked; default button management layout is used.
// On first app run; default button management layout is used.
if(getBoolSetting(CFG_FLIP_BUTTONS)) {
closeSaveBtn(win_node_id);
renameBtn(win_node_id);
deleteBtn(win_node_id);
}else{
renameBtn(win_node_id);
closeSaveBtn(win_node_id);
deleteBtn(win_node_id);
}

T.treeobj.add_action(win_node_id, {
id: 'closeWindow',
class: 'fff-picture-delete ' + K.ACTION_BUTTON_WIN_CLASS,
text: '\xa0',
grouped: true,
title: _T('ttCloseWin'),
callback: actionCloseWindowAndSave,
dataset: { action: 'closeWindow' }
});
function renameBtn (win_node_id){
T.treeobj.add_action(win_node_id, {
id: 'renameWindow',
class: 'fff-pencil ' + K.ACTION_BUTTON_WIN_CLASS,
text: '\xa0',
grouped: true,
title: _T('ttEditWin'),
callback: actionRenameWindow,
dataset: { action: 'renameWindow' }
});
}

T.treeobj.add_action(win_node_id, {
id: 'deleteWindow',
class: 'fff-cross ' + K.ACTION_BUTTON_WIN_CLASS,
text: '\xa0',
grouped: true,
title: _T('ttDeleteWin'),
callback: actionDeleteWindow,
dataset: { action: 'deleteWindow' }
});
function closeSaveBtn (win_node_id) {
T.treeobj.add_action(win_node_id, {
id: 'closeWindow',
class: 'fff-picture-delete ' + K.ACTION_BUTTON_WIN_CLASS,
text: '\xa0',
grouped: true,
title: _T('ttCloseWin'),
callback: actionCloseWindowAndSave,
dataset: {action: 'closeWindow'}
});
}

function deleteBtn (win_node_id){
T.treeobj.add_action(win_node_id, {
id: 'deleteWindow',
class: 'fff-cross ' + K.ACTION_BUTTON_WIN_CLASS,
text: '\xa0',
grouped: true,
title: _T('ttDeleteWin'),
callback: actionDeleteWindow,
dataset: {action: 'deleteWindow'}
});
}
} //addWindowNodeActions

/// Set a timer to prune the window later.
Expand Down

0 comments on commit 3ac0f27

Please sign in to comment.