mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Move the toolbar flags setting into a separate section to allow the
user to set them easily, as discussed git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7154 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
205fdc7045
commit
5a87c5379a
@ -1,3 +1,9 @@
|
|||||||
|
2003-06-11 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* ui/stdtoolbars.ui: move flags to ...
|
||||||
|
|
||||||
|
* ui/default.ui: ... Toolbars section here
|
||||||
|
|
||||||
2003-06-11 John Levon <levon@movementarian.org>
|
2003-06-11 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* ui/stdtoolbars.ui: show Extra toolbar by default
|
* ui/stdtoolbars.ui: show Extra toolbar by default
|
||||||
|
@ -4,3 +4,24 @@
|
|||||||
Include "stdmenus.ui"
|
Include "stdmenus.ui"
|
||||||
|
|
||||||
Include "stdtoolbars.ui"
|
Include "stdtoolbars.ui"
|
||||||
|
|
||||||
|
# Which toolbars to use.
|
||||||
|
#
|
||||||
|
# The second parameter are the flags :
|
||||||
|
#
|
||||||
|
# on: the toolbar is visible
|
||||||
|
# off: the toolbar is not visible
|
||||||
|
# math: the toolbar is visible only when in math
|
||||||
|
# table: the toolbar is visible only when in a table
|
||||||
|
# top: the toolbar should be at the top of the window
|
||||||
|
# bottom: the toolbar should be at the bottom of the window
|
||||||
|
# left: the toolbar should be at the left of the window
|
||||||
|
# right: the toolbar should be at the right of the window
|
||||||
|
#
|
||||||
|
Toolbars
|
||||||
|
"Standard" "on,top"
|
||||||
|
"Extra" "on,top"
|
||||||
|
"Table" "off,bottom"
|
||||||
|
"Math" "off,bottom"
|
||||||
|
"Command Buffer" "off,bottom"
|
||||||
|
End
|
||||||
|
@ -1,17 +1,6 @@
|
|||||||
# A Toolbar starts like :
|
# A Toolbar starts like :
|
||||||
#
|
#
|
||||||
# Toolbar "Name" "on"
|
# Toolbar "Name"
|
||||||
#
|
|
||||||
# The second parameter are the flags :
|
|
||||||
#
|
|
||||||
# on: the toolbar is visible
|
|
||||||
# off: the toolbar is not visible
|
|
||||||
# math: the toolbar is visible only when in math
|
|
||||||
# table: the toolbar is visible only when in a table
|
|
||||||
# top: the toolbar should be at the top of the window
|
|
||||||
# bottom: the toolbar should be at the bottom of the window
|
|
||||||
# left: the toolbar should be at the left of the window
|
|
||||||
# right: the toolbar should be at the right of the window
|
|
||||||
#
|
#
|
||||||
# Only four commands are allowed inside the begin_toolbar and end_toolbar
|
# Only four commands are allowed inside the begin_toolbar and end_toolbar
|
||||||
# directives:
|
# directives:
|
||||||
@ -36,8 +25,6 @@
|
|||||||
#
|
#
|
||||||
# This is the default toolbar:
|
# This is the default toolbar:
|
||||||
|
|
||||||
# slight rationalisations here
|
|
||||||
|
|
||||||
Toolbar "Standard" "on,top"
|
Toolbar "Standard" "on,top"
|
||||||
Layouts
|
Layouts
|
||||||
Item "New document" "buffer-new"
|
Item "New document" "buffer-new"
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2003-06-11 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* lyx_main.C:
|
||||||
|
* ToolbarBackend.h:
|
||||||
|
* ToolbarBackend.C: add "Toolbars" section and
|
||||||
|
put the flags there
|
||||||
|
|
||||||
2003-06-10 Angus Leeming <leeming@lyx.org>
|
2003-06-10 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* lfuns.h:
|
* lfuns.h:
|
||||||
|
@ -71,38 +71,6 @@ void ToolbarBackend::read(LyXLex & lex)
|
|||||||
tb.name = lex.getString();
|
tb.name = lex.getString();
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
|
|
||||||
tb.flags = static_cast<Flags>(0);
|
|
||||||
string flagstr = lex.getString();
|
|
||||||
vector<string> flags = getVectorFromString(flagstr);
|
|
||||||
|
|
||||||
vector<string>::const_iterator cit = flags.begin();
|
|
||||||
vector<string>::const_iterator end = flags.end();
|
|
||||||
|
|
||||||
for (; cit != end; ++cit) {
|
|
||||||
int flag = 0;
|
|
||||||
if (!compare_ascii_no_case(*cit, "off"))
|
|
||||||
flag = OFF;
|
|
||||||
else if (!compare_ascii_no_case(*cit, "on"))
|
|
||||||
flag = ON;
|
|
||||||
else if (!compare_ascii_no_case(*cit, "math"))
|
|
||||||
flag = MATH;
|
|
||||||
else if (!compare_ascii_no_case(*cit, "table"))
|
|
||||||
flag = TABLE;
|
|
||||||
else if (!compare_ascii_no_case(*cit, "top"))
|
|
||||||
flag = TOP;
|
|
||||||
else if (!compare_ascii_no_case(*cit, "bottom"))
|
|
||||||
flag = BOTTOM;
|
|
||||||
else if (!compare_ascii_no_case(*cit, "left"))
|
|
||||||
flag = LEFT;
|
|
||||||
else if (!compare_ascii_no_case(*cit, "right"))
|
|
||||||
flag = RIGHT;
|
|
||||||
else {
|
|
||||||
lyxerr << "ToolbarBackend::read: unrecognised token:`"
|
|
||||||
<< *cit << '\'' << endl;
|
|
||||||
}
|
|
||||||
tb.flags = static_cast<Flags>(tb.flags | flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
|
|
||||||
lex.pushTable(toolTags, TO_LAST - 1);
|
lex.pushTable(toolTags, TO_LAST - 1);
|
||||||
@ -152,6 +120,74 @@ void ToolbarBackend::read(LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ToolbarBackend::readToolbars(LyXLex & lex)
|
||||||
|
{
|
||||||
|
//consistency check
|
||||||
|
if (compare_ascii_no_case(lex.getString(), "toolbars")) {
|
||||||
|
lyxerr << "ToolbarBackend::read: ERROR wrong token:`"
|
||||||
|
<< lex.getString() << '\'' << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
lex.next(true);
|
||||||
|
|
||||||
|
while (lex.isOK()) {
|
||||||
|
string name = lex.getString();
|
||||||
|
lex.next(true);
|
||||||
|
|
||||||
|
if (!compare_ascii_no_case(name, "end"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Toolbars::iterator tcit = toolbars.begin();
|
||||||
|
Toolbars::iterator tend = toolbars.end();
|
||||||
|
for (; tcit != tend; ++tcit) {
|
||||||
|
if (tcit->name == name)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tcit == tend) {
|
||||||
|
lyxerr << "ToolbarBackend: undefined toolbar "
|
||||||
|
<< name << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tcit->flags = static_cast<Flags>(0);
|
||||||
|
string flagstr = lex.getString();
|
||||||
|
lex.next(true);
|
||||||
|
vector<string> flags = getVectorFromString(flagstr);
|
||||||
|
|
||||||
|
vector<string>::const_iterator cit = flags.begin();
|
||||||
|
vector<string>::const_iterator end = flags.end();
|
||||||
|
|
||||||
|
for (; cit != end; ++cit) {
|
||||||
|
int flag = 0;
|
||||||
|
if (!compare_ascii_no_case(*cit, "off"))
|
||||||
|
flag = OFF;
|
||||||
|
else if (!compare_ascii_no_case(*cit, "on"))
|
||||||
|
flag = ON;
|
||||||
|
else if (!compare_ascii_no_case(*cit, "math"))
|
||||||
|
flag = MATH;
|
||||||
|
else if (!compare_ascii_no_case(*cit, "table"))
|
||||||
|
flag = TABLE;
|
||||||
|
else if (!compare_ascii_no_case(*cit, "top"))
|
||||||
|
flag = TOP;
|
||||||
|
else if (!compare_ascii_no_case(*cit, "bottom"))
|
||||||
|
flag = BOTTOM;
|
||||||
|
else if (!compare_ascii_no_case(*cit, "left"))
|
||||||
|
flag = LEFT;
|
||||||
|
else if (!compare_ascii_no_case(*cit, "right"))
|
||||||
|
flag = RIGHT;
|
||||||
|
else {
|
||||||
|
lyxerr << "ToolbarBackend::read: unrecognised token:`"
|
||||||
|
<< *cit << '\'' << endl;
|
||||||
|
}
|
||||||
|
tcit->flags = static_cast<Flags>(tcit->flags | flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
usedtoolbars.push_back(*tcit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ToolbarBackend::add(Toolbar & tb, int action, string const & tooltip)
|
void ToolbarBackend::add(Toolbar & tb, int action, string const & tooltip)
|
||||||
{
|
{
|
||||||
tb.items.push_back(make_pair(action, tooltip));
|
tb.items.push_back(make_pair(action, tooltip));
|
||||||
|
@ -68,16 +68,19 @@ public:
|
|||||||
|
|
||||||
/// iterator for all toolbars
|
/// iterator for all toolbars
|
||||||
Toolbars::const_iterator begin() const {
|
Toolbars::const_iterator begin() const {
|
||||||
return toolbars.begin();
|
return usedtoolbars.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolbars::const_iterator end() const {
|
Toolbars::const_iterator end() const {
|
||||||
return toolbars.end();
|
return usedtoolbars.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// read a toolbar from the file
|
/// read a toolbar from the file
|
||||||
void read(LyXLex &);
|
void read(LyXLex &);
|
||||||
|
|
||||||
|
/// read the used toolbars
|
||||||
|
void readToolbars(LyXLex &);
|
||||||
|
|
||||||
/// return a full path of an XPM for the given action
|
/// return a full path of an XPM for the given action
|
||||||
static string const getIcon(int action);
|
static string const getIcon(int action);
|
||||||
|
|
||||||
@ -90,6 +93,9 @@ private:
|
|||||||
|
|
||||||
/// all the toolbars
|
/// all the toolbars
|
||||||
Toolbars toolbars;
|
Toolbars toolbars;
|
||||||
|
|
||||||
|
/// toolbars listed
|
||||||
|
Toolbars usedtoolbars;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The global instance
|
/// The global instance
|
||||||
|
@ -635,6 +635,7 @@ void LyX::readUIFile(string const & name)
|
|||||||
enum Uitags {
|
enum Uitags {
|
||||||
ui_menuset = 1,
|
ui_menuset = 1,
|
||||||
ui_toolbar,
|
ui_toolbar,
|
||||||
|
ui_toolbars,
|
||||||
ui_include,
|
ui_include,
|
||||||
ui_last
|
ui_last
|
||||||
};
|
};
|
||||||
@ -642,7 +643,8 @@ void LyX::readUIFile(string const & name)
|
|||||||
struct keyword_item uitags[ui_last - 1] = {
|
struct keyword_item uitags[ui_last - 1] = {
|
||||||
{ "include", ui_include },
|
{ "include", ui_include },
|
||||||
{ "menuset", ui_menuset },
|
{ "menuset", ui_menuset },
|
||||||
{ "toolbar", ui_toolbar }
|
{ "toolbar", ui_toolbar },
|
||||||
|
{ "toolbars", ui_toolbars }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ensure that a file is read only once (prevents include loops)
|
// Ensure that a file is read only once (prevents include loops)
|
||||||
@ -697,6 +699,10 @@ void LyX::readUIFile(string const & name)
|
|||||||
toolbarbackend.read(lex);
|
toolbarbackend.read(lex);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ui_toolbars:
|
||||||
|
toolbarbackend.readToolbars(lex);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!rtrim(lex.getString()).empty())
|
if (!rtrim(lex.getString()).empty())
|
||||||
lex.printError("LyX::ReadUIFile: "
|
lex.printError("LyX::ReadUIFile: "
|
||||||
|
Loading…
Reference in New Issue
Block a user