toolbar4.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6811 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-04-15 01:06:13 +00:00
parent 4004825bd4
commit 84640bc0f2
17 changed files with 728 additions and 74 deletions

View File

@ -1,3 +1,12 @@
2003-04-15 John Levon <levon@movementarian.org>
* ui/new.ui: add new ui for testing
2003-04-15 John Levon <levon@movementarian.org>
* ui/default.ui: add toolbar placement flags,
and Minibuffer
2003-04-11 Rob Lahaye <lahaye@users.sourceforge.net> 2003-04-11 Rob Lahaye <lahaye@users.sourceforge.net>
* configure.m4: add another Grace conversion from agr to ppm. * configure.m4: add another Grace conversion from agr to ppm.
@ -11,7 +20,6 @@
* ToolbarBackend.h: * ToolbarBackend.h:
* ToolbarBackend.C: handle toolbar on/off settings * ToolbarBackend.C: handle toolbar on/off settings
2003-04-10 John Levon <levon@movementarian.org> 2003-04-10 John Levon <levon@movementarian.org>
* images/: new icons, mostly taken from kdeart * images/: new icons, mostly taken from kdeart

View File

@ -395,10 +395,18 @@ End
# #
# Toolbar "Name" "on" # Toolbar "Name" "on"
# #
# The second parameter is the status, and can be "on", "off", "math" # The second parameter are the flags :
# or "table". The last two make the toolbars appear and disappear automatically.
# #
# Only three commands are allowed inside the begin_toolbar and end_toolbar # 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
# directives: # directives:
# Item "<action> [<parameter>]" adds an icon to the toolbar performing # Item "<action> [<parameter>]" adds an icon to the toolbar performing
# "<action> <parameter>" # "<action> <parameter>"
@ -410,6 +418,8 @@ End
# #
# Separator adds some spacing to the toolbar # Separator adds some spacing to the toolbar
# #
# Minibuffer adds the command buffer (Qt only, only one may exist)
#
# The icons are found in the lib/image direcory under the name # The icons are found in the lib/image direcory under the name
# action.xpm or action_parameter.xpm. # action.xpm or action_parameter.xpm.
# #
@ -417,7 +427,7 @@ End
# #
# This is the default toolbar: # This is the default toolbar:
Toolbar "Standard" "on" Toolbar "Standard" "on,top"
Layouts Layouts
Item "Open document" "file-open" Item "Open document" "file-open"
Item "Save document" "buffer-write" Item "Save document" "buffer-write"
@ -442,3 +452,7 @@ Toolbar "Standard" "on"
Item "Insert graphics" "dialog-show-new-inset graphics" Item "Insert graphics" "dialog-show-new-inset graphics"
Item "Insert table" "tabular-insert" Item "Insert table" "tabular-insert"
End End
Toolbar "Command Buffer" "on,bottom"
Minibuffer
End

545
lib/ui/new.ui Normal file
View File

@ -0,0 +1,545 @@
# This is the default LyX user interface definition file. -*- text -*-
# The syntax should be straightforward enough.
# General aims : consistent naming, smaller menus, more accurate enable/disable
Menuset
Menubar
# Make the first 4 menus be as much as expected as possible
Submenu "File|F" "file"
Submenu "Edit|E" "edit"
Submenu "View|V" "view"
Submenu "Insert|I" "insert"
Submenu "Navigate|N" "navigate"
Submenu "Document|D" "document"
Submenu "Tools|T" "tools"
Submenu "Help|H" "help"
End
#
# FILE MENU
#
Menu "file"
Item "New|N" "buffer-new"
Item "New from Template...|T" "buffer-new-template"
Item "Open...|O" "file-open"
# This seems a much more sensible place to me
Submenu "Open recent|t" "lastfiles"
Separator
Item "Close|C" "buffer-close"
Item "Save|S" "buffer-write"
Item "Save As...|A" "buffer-write-as"
Item "Revert|R" "buffer-reload"
Submenu "Version Control|V" "file_vc"
Separator
Submenu "Import|I" "file_import"
Submenu "Export|E" "file_export"
Item "Print...|P" "buffer-print"
OptItem "Fax...|F" "buffer-export fax"
Separator
Item "Exit|x" "lyx-quit"
End
Menu "lastfiles"
Lastfiles
End
Menu "file_vc"
OptItem "Register...|R" "vc-register"
OptItem "Check In Changes...|I" "vc-check-in"
OptItem "Check Out for Edit|O" "vc-check-out"
OptItem "Revert to Last Version|L" "vc-revert"
OptItem "Undo Last Check In|U" "vc-undo-last"
OptItem "Show History|H" "vc-history"
End
Menu "file_import"
ImportFormats
End
Menu "file_export"
ExportFormats
Item "Custom...|C" "buffer-export custom"
End
#
# EDIT MENU
#
Menu "edit"
Item "Undo|U" "undo"
Item "Redo|d" "redo"
Separator
Item "Cut|C" "cut"
Item "Copy|o" "copy"
Item "Paste|a" "paste"
Item "Find & Replace...|F" "find-replace"
Separator
Item "Text Style...|S" "layout-character"
Item "Paragraph Settings...|a" "layout-paragraph"
Separator
# Mathed b0rkage means these don't work properly
OptSubmenu "Table|T" "edit_tabular"
OptSubmenu "Math|M" "edit_math"
Separator
OptItem "Increase List Depth|I" "depth-increment"
OptItem "Decrease List Depth|D" "depth-decrement"
# This is where the context-specific stuff is supposed to go.
# The idea is that everything on here can disappear and should
# only appear when relevant (getStatus). Only stuff that needs
# a right-click to bring up the dialog should appear here (it is not
# obvious what the context is for the others)
OptItem "Table Settings..." "dialog-show-next-inset tabular"
OptItem "TeX Code Settings..." "dialog-show-next-inset ert"
OptItem "Float Settings..." "dialog-show-next-inset float"
OptItem "Minipage Settings..." "dialog-show-next-inset minipage"
OptItem "Text Wrap Settings..." "dialog-show-next-inset wrap"
End
# not much we can do to help here
Menu "edit_tabular"
Item "Add Row|A" "tabular-feature append-row"
Item "Delete Row|w" "tabular-feature delete-row"
Separator
Item "Add Column|u" "tabular-feature append-column"
Item "Delete Column|D" "tabular-feature delete-column"
Separator
Item "Multicolumn|M" "tabular-feature multicolumn"
Separator
Item "Top Line|T" "tabular-feature toggle-line-top"
Item "Bottom Line|B" "tabular-feature toggle-line-bottom"
Item "Left Line|L" "tabular-feature toggle-line-left"
Item "Right Line|R" "tabular-feature toggle-line-right"
Separator
Item "Left aligned|e" "tabular-feature align-left"
Item "Centered|C" "tabular-feature align-center"
Item "Right aligned|i" "tabular-feature align-right"
Separator
Item "Top aligned|o" "tabular-feature valign-top"
Item "Vertically Centered|V" "tabular-feature valign-center"
Item "Bottom aligned|g" "tabular-feature valign-bottom"
End
Menu "edit_math"
Item "Toggle Numbering|N" "math-number"
Item "Toggle Numbering of Line|u" "math-nonumber"
Submenu "Change Limits Type|L" "edit_math_limits"
Separator
Submenu "Change Formula Type|F" "edit_math_mutate"
Separator
Submenu "Use Computer Algebra System|S" "edit_math_extern"
Separator
Submenu "Alignment|A" "edit_math_align"
Separator
Item "Add Row|R" "tabular-feature append-row"
Item "Delete Row|D" "tabular-feature delete-row"
Item "Copy Row" "tabular-feature copy-row"
Item "Swap Rows" "tabular-feature swap-row"
Separator
Item "Add Column|C" "tabular-feature append-column"
Item "Delete Column|e" "tabular-feature delete-column"
Item "Copy Column" "tabular-feature copy-column"
Item "Swap Columns" "tabular-feature swap-column"
End
Menu "edit_math_limits"
Item "Default|t" "math-limits empty"
Item "Display|D" "math-limits limits"
Item "Inline|I" "math-limits nolimits"
End
Menu "edit_math_extern"
Item "Octave" "math-extern octave"
Item "Maxima" "math-extern maxima"
Item "Mathematica" "math-extern mathematica"
Separator
Item "Maple, simplify" "math-extern maple simplify"
Item "Maple, factor" "math-extern maple factor"
Item "Maple, evalm" "math-extern maple evalm"
Item "Maple, evalf" "math-extern maple evalf"
End
Menu "edit_math_mutate"
Item "Inline Formula|I" "math-mutate simple"
Item "Displayed Formula|D" "math-mutate equation"
Item "Eqnarray Environment|q" "math-mutate eqnarray"
Item "Align Environment|A" "math-mutate align"
Item "AlignAt Environment" "math-mutate alignat"
Item "Flalign Environment|f" "math-mutate flalign"
Item "Gather Environment" "math-mutate gather"
Item "Multline Environment" "math-mutate multline"
End
Menu "edit_math_align"
Item "Left-aligned|L" "tabular-feature align-left"
Item "Centered|C" "tabular-feature align-center"
Item "Right-aligned|R" "tabular-feature align-right"
Separator
Item "Top-aligned|T" "tabular-feature valign-top"
Item "Centered Vertically|e" "tabular-feature valign-center"
Item "Bottom-aligned|B" "tabular-feature valign-bottom"
End
#
# VIEW MENU
#
Menu "view"
Item "Open Float|O" "inset-toggle"
# A common feature request JMarc wants to see
# Item "Open All Footnotes|F" "open-footnotes"
# Item "Close All Footnotes|C" "close-footnotes"
# FIXME: better in Document menu ? Not sure.
Item "Remove All Error Boxes|E" "error-remove-all"
Item "Display Tooltips|D" "toggle-tooltips"
Separator
Submenu "Update|U" "document_update"
ViewFormats
Separator
Documents
End
Menu "document_update"
UpdateFormats
End
#
# INSERT MENU
#
Menu "insert"
# Try and group things a little better, and percolate the most
# commonly used to good positions (exception being mathed, but
# most people using mathed learn key shortcuts quite quickly anyway)
Item "Citation Reference...|C" "dialog-show-new-inset citation"
Item "Cross Reference...|R" "dialog-show-new-inset ref"
Item "Label...|L" "label-insert"
Item "Index Entry|I" "index-insert"
Separator
Submenu "Math|h" "insert_math"
Submenu "Special Character|S" "insert_special"
Submenu "Float|a" "insert_float"
Submenu "List / TOC|O" "insert_toc"
# YUCK
Submenu "File|e" "insert_file"
Submenu "Note|N" "insert_note"
Separator
# I'm going to kill this dumb dialog, but for now ...
Item "Table...|T" "tabular-insert"
Item "Minipage|p" "minipage-insert"
Item "Graphics...|G" "dialog-show-new-inset graphics"
Item "URL...|U" "url-insert"
Item "Short Title" "optional-insert"
Item "TeX|X" "ert-insert"
Item "External Material...|x" "dialog-show-new-inset external"
Item "Child document...|d" "dialog-show-new-inset include"
End
# Not great, but the main Insert menu is seriously unwieldly
Menu "insert_note"
Item "Footnote|F" "footnote-insert"
Item "Marginal Note|M" "marginalnote-insert"
Item "Note|N" "note-insert"
End
Menu "insert_special"
Item "Superscript|S" "command-sequence math-mode ; math-superscript ; font-free-apply; "
Item "Subscript|u" "command-sequence math-mode ; math-subscript ; font-free-apply; "
Item "Horizontal Fill|H" "hfill-insert"
Item "Hyphenation Point|P" "hyphenation-point-insert"
Item "Ligature Break|k" "ligature-break-insert"
Item "Protected Blank|B" "protected-space-insert"
Item "Linebreak|L" "break-line"
Item "Ellipsis|i" "dots-insert"
Item "End of Sentence|E" "end-of-sentence-period-insert"
Item "Ordinary Quote|Q" "self-insert \""
Item "Menu Separator|M" "menu-separator-insert"
End
Menu "insert_math"
Item "Inline Formula|I" "math-mode"
Item "Display Formula|D" "math-display"
Item "Eqnarray Environment|E" "command-sequence math-mode; math-mutate eqnarray;"
Item "AMS align Environment|A" "command-sequence math-mode; math-mutate align;"
Item "AMS alignat Environment|t" "command-sequence math-mode; math-mutate alignat;"
Item "AMS flalign Environment|f" "command-sequence math-mode; math-mutate flalign;"
Item "AMS gather Environment" "command-sequence math-mode; math-mutate gather;"
Item "AMS multline Environment" "command-sequence math-mode; math-mutate multline;"
Separator
Item "Array Environment|y" "math-matrix 2 2"
Item "Cases Environment|C" "math-insert \cases"
Separator
Submenu "Font Change|f" "insert_math_font"
Item "Math Panel|l" "math-panel"
End
Menu "insert_math_font"
Item "Math normal font" "math-insert \mathnormal"
Separator
Item "Math calligraphic family" "math-insert \mathcal"
Item "Math fraktur family" "math-insert \mathfrak"
Item "Math roman family" "math-insert \mathrm"
Item "Math sans serif family" "math-insert \mathsf"
Separator
Item "Math bold series" "math-insert \mathbf"
Separator
Item "Text normal font" "math-insert \textnormal"
Separator
Item "Text roman family" "math-insert \textrm"
Item "Text sans serif family" "math-insert \textsf"
Item "Text typewriter family" "math-insert \texttt"
Separator
Item "Text bold series" "math-insert \textbf"
Item "Text medium series" "math-insert \textmd"
Separator
Item "Text italic shape" "math-insert \textit"
Item "Text small caps shape" "math-insert \textsc"
Item "Text slanted shape" "math-insert \textsl"
Item "Text upright shape" "math-insert \textup"
End
Menu "insert_float"
FloatInsert
# This has got to be better than "Wrap", anyway
Item "Text Wrap Float|W" "wrap-insert figure"
End
Menu "insert_toc"
Item "Table of Contents|C" "toc-insert"
FloatListInsert
Item "Index List|I" "index-print"
Item "BibTeX Reference...|B" "dialog-show-new-inset bibtex"
End
Menu "insert_file"
Item "LyX Document...|X" "file-insert"
Item "ASCII as Lines...|L" "file-insert-ascii"
Item "ASCII as Paragraphs...|P" "file-insert-ascii-para"
End
#
# DOCUMENT MENU
#
Menu "document"
OptItem "Build Program|B" "build-program"
Item "LaTeX Log File...|L" "latex-view-log"
Item "Table of Contents...|T" "toc-view"
Separator
Submenu "Change tracking|C" "edit_change"
Item "LaTeX Preamble...|P" "layout-preamble"
Item "Settings...|S" "layout-document"
Item "Start Appendix Here|A" "appendix"
End
Menu "edit_change"
Item "Track changes|T" "track-changes"
Item "Merge changes...|M" "merge-changes"
Item "Accept all changes|A" "accept-all-changes"
Item "Reject all changes|R" "reject-all-changes"
End
#
# NAVIGATE MENU
#
Menu "navigate"
Submenu "Bookmarks|B" "navigate_bookmarks"
Item "Error|E" "error-next"
Item "Note|N" "note-next"
Item "Refs|R" "reference-goto"
Separator
Toc
End
Menu "navigate_bookmarks"
Item "Save Bookmark 1|S" "bookmark-save 1"
Item "Save Bookmark 2" "bookmark-save 2"
Item "Save Bookmark 3" "bookmark-save 3"
Separator
Item "Go to Bookmark 1|1" "bookmark-goto 1"
Item "Go to Bookmark 2|2" "bookmark-goto 2"
Item "Go to Bookmark 3|3" "bookmark-goto 3"
End
#
# TOOLS MENU
#
Menu "tools"
Item "Spellchecker...|S" "spellchecker"
OptItem "Thesaurus...|T" "thesaurus-entry"
OptItem "Check TeX|h" "buffer-chktex"
Separator
Item "View Child Processes...|C" "show-forks"
Item "TeX Information...|I" "help-Texinfo"
Separator
# A LOT of applications have Tools->Prefs. Remember this
# should be rarely used - Edit menu is not a good place to
# have it.
Item "Preferences...|P" "dialog-preferences"
Item "Reconfigure|R" "reconfigure"
End
#
# HELP MENU
#
Menu "help"
Item "Introduction|I" "help-open Intro"
Item "Tutorial|T" "help-open Tutorial"
Item "User's Guide|U" "help-open UserGuide"
Item "Extended Features|E" "help-open Extended"
Item "Customization|C" "help-open Customization"
Item "FAQ|F" "help-open FAQ"
Item "Table of Contents|a" "help-open TOC"
Item "LaTeX Configuration|L" "help-open LaTeXConfig"
Separator
Item "About LyX...|X" "help-aboutlyx"
End
End
# A Toolbar starts like :
#
# Toolbar "Name" "on"
#
# 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
# directives:
# Item "The tooltip" "<action> [<parameter>]" adds an icon to the toolbar performing
# "<action> <parameter>"
# Examples:
# Item "Small font" "font-size small"
# Item Emphasized set-emph
#
# Layouts adds the layouts combo-box to the toolbar
#
# Separator adds some spacing to the toolbar
#
# Minibuffer adds the command buffer (Qt only, only one may exist)
#
# The icons are found in the lib/image direcory under the name
# action.xpm or action_parameter.xpm, except for math-insert, which
# is e.g. lib/image/math/sum.xpm. Note that some characters are
# replaced (e.g. ')' -> rbracket).
#
# All other lyx commands will get a "unknown" icon.
#
# This is the default toolbar:
# slight rationalisations here
Toolbar "Standard" "on,top"
Layouts
Item "New document" "buffer-new"
Item "Open document" "file-open"
Item "Save document" "buffer-write"
Item "Print document" "buffer-print"
Separator
Item "Undo" "undo"
Item "Redo" "redo"
Item "Cut" "cut"
Item "Copy" "copy"
Item "Paste" "paste"
Item "Find and replace" "find-replace"
Separator
Item "Toggle emphasis style" "font-emph"
Item "Toggle noun style" "font-noun"
Item "Toggle user style" "font-free-apply"
Separator
Item "Insert math" "math-mode"
Item "Insert graphics" "dialog-show-new-inset graphics"
Item "Insert table" "tabular-insert 4 4"
End
Toolbar "Extra" "off,top"
Item "Numbered list" "layout Enumerate"
Item "Itemized list" "layout Itemize"
Item "List" "layout List"
Item "Description" "layout Description"
Item "Increase depth" "depth-increment"
Item "Decrease depth" "depth-decrement"
Separator
Item "Insert figure float" "float-insert figure"
Item "Insert table float" "float-insert table"
Item "Insert label" "label-insert"
Item "Insert cross-reference" "dialog-show-new-inset ref"
Item "Insert citation" "dialog-show-new-inset citation"
Item "Insert index entry" "index-insert"
Separator
Item "Insert footnote" "footnote-insert"
Item "Insert margin note" "marginalnote-insert"
Item "Insert note" "note-insert"
Item "Insert URL" "url-insert"
Item "Insert TeX" "ert-insert"
Item "Include file" "dialog-show-new-inset include"
Separator
Item "Text Style" "layout-character"
Item "Paragraph Style" "layout-paragraph"
Item "Table of contents" "toc-view"
Item "Check spelling" "spellchecker"
Item "Thesaurus" "thesaurus-entry"
End
Toolbar "Table" "off,bottom"
Item "Add row" "tabular-feature append-row"
Item "Add column" "tabular-feature append-column"
Item "Delete row" "tabular-feature delete-row"
Item "Delete column" "tabular-feature delete-column"
Separator
Item "Set top line" "tabular-feature toggle-line-top"
Item "Set bottom line" "tabular-feature toggle-line-bottom"
Item "Set left line" "tabular-feature toggle-line-left"
Item "Set right line" "tabular-feature toggle-line-right"
Item "Set all lines" "tabular-feature set-all-lines"
Item "Unset all lines" "tabular-feature unset-all-lines"
Separator
Item "Left aligned" "tabular-feature align-left"
Item "Centered" "tabular-feature align-center"
Item "Right aligned" "tabular-feature align-right"
Item "Top aligned" "tabular-feature valign-top"
Item "Vertically centered" "tabular-feature valign-center"
Item "Bottom aligned" "tabular-feature valign-bottom"
Separator
Item "Rotate cell" "tabular-feature set-rotate-cell"
Item "Rotate table" "tabular-feature set-rotate-tabular"
Item "Set multi-column" "tabular-feature multicolumn"
End
Toolbar "Math" "off,bottom"
Item "Show math panel" "math-panel"
Item "Set display mode" "math-display"
Item "Subscript" "math-subscript"
Item "Superscript" "math-superscript"
Item "Insert root" "math-insert \sqrt"
Item "Insert square root" "math-insert \root"
Item "Insert sum" "math-insert \sum"
Item "Insert integral" "math-insert \int"
Item "Insert product" "math-insert \prod"
Separator
Item "Insert fraction" "math-insert \frac"
Item "Insert ( )" "math-delim ( )"
Item "Insert [ ]" "math-delim [ ]"
Item "Insert { }" "math-delim { }"
Separator
Item "Insert matrix" "math-matrix 2 2"
Item "Insert cases" "math-insert \cases"
Item "Add row" "tabular-feature append-row"
Item "Add column" "tabular-feature append-column"
Item "Delete row" "tabular-feature delete-row"
Item "Delete column" "tabular-feature delete-column"
End
Toolbar "Command Buffer" "off,bottom"
Minibuffer
End

View File

@ -1,3 +1,11 @@
2003-04-15 John Levon <levon@movementarian.org>
* MenuBackend.C: make the doc files length shorter
* ToolbarBackend.h:
* ToolbarBackend.C: handle toolbar placement flags,
Minibuffer
2003-04-15 Lars Gullik Bjønnes <larsbj@gullik.net> 2003-04-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* paragraph_pimpl.C (simpleTeXSpecialChars): take a outerfont arg, * paragraph_pimpl.C (simpleTeXSpecialChars): take a outerfont arg,

View File

@ -390,7 +390,7 @@ void expandDocuments(Menu & tomenu, LyXView const * view)
for (; docit != end; ++docit, ++ii) { for (; docit != end; ++docit, ++ii) {
int const action = int const action =
lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *docit); lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *docit);
string label = MakeDisplayPath(*docit, 30); string label = MakeDisplayPath(*docit, 20);
if (ii < 10) if (ii < 10)
label = tostr(ii) + ". " + label + '|' + tostr(ii); label = tostr(ii) + ". " + label + '|' + tostr(ii);
tomenu.add(MenuItem(MenuItem::Command, label, action), view); tomenu.add(MenuItem(MenuItem::Command, label, action), view);

View File

@ -22,7 +22,10 @@
#include "frontends/controllers/ControlMath.h" #include "frontends/controllers/ControlMath.h"
#include <vector>
using std::endl; using std::endl;
using std::vector;
ToolbarBackend toolbarbackend; ToolbarBackend toolbarbackend;
@ -33,14 +36,15 @@ enum tooltags {
TO_ENDTOOLBAR, TO_ENDTOOLBAR,
TO_SEPARATOR, TO_SEPARATOR,
TO_LAYOUTS, TO_LAYOUTS,
TO_MINIBUFFER,
TO_LAST TO_LAST
}; };
struct keyword_item toolTags[TO_LAST - 1] = { struct keyword_item toolTags[TO_LAST - 1] = {
{ "end", TO_ENDTOOLBAR }, { "end", TO_ENDTOOLBAR },
{ "item", TO_ADD }, { "item", TO_ADD },
{ "layouts", TO_LAYOUTS }, { "layouts", TO_LAYOUTS },
{ "minibuffer", TO_MINIBUFFER },
{ "separator", TO_SEPARATOR } { "separator", TO_SEPARATOR }
}; };
@ -64,20 +68,38 @@ void ToolbarBackend::read(LyXLex & lex)
Toolbar tb; Toolbar tb;
tb.name = lex.getString(); tb.name = lex.getString();
lex.next(true); lex.next(true);
string type = lex.getString();
if (!compare_ascii_no_case(type, "off")) tb.flags = static_cast<Flags>(0);
tb.display_type = OFF; string flagstr = lex.getString();
else if (!compare_ascii_no_case(type, "on")) vector<string> flags = getVectorFromString(flagstr);
tb.display_type = ON;
else if (!compare_ascii_no_case(type, "math")) vector<string>::const_iterator cit = flags.begin();
tb.display_type = MATH; vector<string>::const_iterator end = flags.end();
else if (!compare_ascii_no_case(type, "table"))
tb.display_type = TABLE; for (; cit != end; ++cit) {
else { int flag = 0;
lyxerr << "ToolbarBackend::read: unrecognised token:`" if (!compare_ascii_no_case(*cit, "off"))
<< type << '\'' << endl; 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;
@ -101,6 +123,10 @@ void ToolbarBackend::read(LyXLex & lex)
} }
break; break;
case TO_MINIBUFFER:
add(tb, MINIBUFFER);
break;
case TO_SEPARATOR: case TO_SEPARATOR:
add(tb, SEPARATOR); add(tb, SEPARATOR);
break; break;

View File

@ -24,12 +24,12 @@ class ToolbarBackend {
public: public:
/// The special toolbar actions /// The special toolbar actions
enum ItemType { enum ItemType {
/// the command buffer
MINIBUFFER = -3,
/// adds space between buttons in the toolbar /// adds space between buttons in the toolbar
SEPARATOR = -3, SEPARATOR = -2,
/// a special combox insead of a button /// a special combox insead of a button
LAYOUTS = -2, LAYOUTS = -1,
/// begin a new line of button (not working)
NEWLINE = -1
}; };
/// action, tooltip /// action, tooltip
@ -38,12 +38,16 @@ public:
/// the toolbar items /// the toolbar items
typedef std::vector<std::pair<int, string> > Items; typedef std::vector<std::pair<int, string> > Items;
/// possibly display types /// toolbar flags
enum DisplayType { enum Flags {
OFF, //< never shown ON = 1, //< always shown
ON, //< always shown OFF = 2, //< never shown
MATH, //< shown when in math MATH = 4, //< shown when in math
TABLE //< shown when in table TABLE = 8, //< shown when in table
TOP = 16, //< show at top
BOTTOM = 32, //< show at bottom
LEFT = 64, //< show at left
RIGHT = 128 //< show at right
}; };
/// a toolbar /// a toolbar
@ -52,8 +56,8 @@ public:
string name; string name;
/// toolbar contents /// toolbar contents
Items items; Items items;
/// display type /// flags
DisplayType display_type; Flags flags;
}; };
typedef std::vector<Toolbar> Toolbars; typedef std::vector<Toolbar> Toolbars;

View File

@ -1,3 +1,7 @@
2003-04-15 John Levon <levon@movementarian.org>
* LyXView.C: toolbar flags changed
2003-04-11 Alfredo Braunstein <abraunst@libero.it> 2003-04-11 Alfredo Braunstein <abraunst@libero.it>
* screen.C (update): add calls to updateRowPositions() before * screen.C (update): add calls to updateRowPositions() before

View File

@ -48,17 +48,10 @@ void Toolbar::update(bool in_math, bool in_table)
ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end(); ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
for (; cit != end; ++cit) { for (; cit != end; ++cit) {
switch (cit->display_type) { if (cit->flags & ToolbarBackend::MATH)
case ToolbarBackend::OFF: pimpl_->displayToolbar(*cit, in_math);
case ToolbarBackend::ON: else if (cit->flags & ToolbarBackend::TABLE)
break; pimpl_->displayToolbar(*cit, in_table);
case ToolbarBackend::MATH:
pimpl_->displayToolbar(*cit, in_math);
break;
case ToolbarBackend::TABLE:
pimpl_->displayToolbar(*cit, in_table);
break;
}
} }
} }

View File

@ -1,3 +1,15 @@
2003-04-15 John Levon <levon@movementarian.org>
* QCommandBuffer.h:
* QCommandBuffer.C: make a widget not a toolbar
* QtView.h:
* QtView.C: don't let the toolbars be movable.
Create addCommandBuffer(), and handle no command buffer.
* Toolbar_pimpl.C: handle toolbar placement flags, and
Minibuffer.
2003-04-14 John Levon <levon@movementarian.org> 2003-04-14 John Levon <levon@movementarian.org>
* QPrefs.C: fix warning * QPrefs.C: fix warning

View File

@ -22,8 +22,10 @@
#include <qcombobox.h> #include <qcombobox.h>
#include <qlistbox.h> #include <qlistbox.h>
#include <qtoolbutton.h>
#include <qpixmap.h> #include <qpixmap.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qpushbutton.h>
#include "LString.h" #include "LString.h"
@ -61,34 +63,36 @@ protected:
} // end of anon } // end of anon
QCommandBuffer::QCommandBuffer(QtView * view, ControlCommandBuffer & control) QCommandBuffer::QCommandBuffer(QtView * view, QWidget * parent, ControlCommandBuffer & control)
: QToolBar(view), view_(view), controller_(control) : QWidget(parent), view_(view), controller_(control)
{ {
setHorizontalStretchable(true);
QPixmap qpup(toqstr(LibFileSearch("images", "up", "xpm"))); QPixmap qpup(toqstr(LibFileSearch("images", "up", "xpm")));
QPixmap qpdown(toqstr(LibFileSearch("images", "down", "xpm"))); QPixmap qpdown(toqstr(LibFileSearch("images", "down", "xpm")));
QToolButton * up = new QToolButton(qpup, qt_("Previous command"), "", this, SLOT(up()), this); QVBoxLayout * top = new QVBoxLayout(this);
up->setFocusPolicy(NoFocus); QHBoxLayout * layout = new QHBoxLayout(0);
up->show();
QToolButton * down = new QToolButton(qpdown, qt_("Next command"), "", this, SLOT(down()), this); QPushButton * up = new QPushButton(qpup, "", this);
down->setFocusPolicy(NoFocus); QToolTip::add(up, qt_("Previous command"));
down->show(); connect(up, SIGNAL(clicked()), this, SLOT(up()));
QPushButton * down = new QPushButton(qpdown, "", this);
QToolTip::add(down, qt_("Next command"));
connect(down, SIGNAL(clicked()), this, SLOT(down()));
edit_ = new QCommandEdit(this); edit_ = new QCommandEdit(this);
edit_->setMinimumSize(edit_->sizeHint()); edit_->setMinimumSize(edit_->sizeHint());
edit_->setFocusPolicy(ClickFocus); edit_->setFocusPolicy(ClickFocus);
edit_->show();
setStretchableWidget(edit_);
show();
connect(edit_, SIGNAL(escapePressed()), this, SLOT(cancel())); connect(edit_, SIGNAL(escapePressed()), this, SLOT(cancel()));
connect(edit_, SIGNAL(returnPressed()), this, SLOT(dispatch())); connect(edit_, SIGNAL(returnPressed()), this, SLOT(dispatch()));
connect(edit_, SIGNAL(tabPressed()), this, SLOT(complete())); connect(edit_, SIGNAL(tabPressed()), this, SLOT(complete()));
connect(edit_, SIGNAL(upPressed()), this, SLOT(up())); connect(edit_, SIGNAL(upPressed()), this, SLOT(up()));
connect(edit_, SIGNAL(downPressed()), this, SLOT(down())); connect(edit_, SIGNAL(downPressed()), this, SLOT(down()));
layout->addWidget(up, 0);
layout->addWidget(down, 0);
layout->addWidget(edit_, 10);
top->addLayout(layout);
} }

View File

@ -12,18 +12,17 @@
#ifndef QCOMMANDBUFFER_H #ifndef QCOMMANDBUFFER_H
#define QCOMMANDBUFFER_H #define QCOMMANDBUFFER_H
#include <qwidget.h>
#include <qtoolbar.h>
class QtView; class QtView;
class QCommandEdit; class QCommandEdit;
class QListBoxItem; class QListBoxItem;
class ControlCommandBuffer; class ControlCommandBuffer;
class QCommandBuffer : public QToolBar { class QCommandBuffer : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
QCommandBuffer(QtView * view, ControlCommandBuffer & control); QCommandBuffer(QtView * view, QWidget * parent, ControlCommandBuffer & control);
/// focus the edit widget /// focus the edit widget
void focus_command(); void focus_command();

View File

@ -54,7 +54,7 @@ qfont_loader fontloader;
QtView::QtView(unsigned int width, unsigned int height) QtView::QtView(unsigned int width, unsigned int height)
: QMainWindow(), LyXView() : QMainWindow(), LyXView(), commandbuffer_(0)
{ {
resize(width, height); resize(width, height);
@ -71,12 +71,6 @@ QtView::QtView(unsigned int width, unsigned int height)
view_state_changed.connect(boost::bind(&QtView::update_view_state, this)); view_state_changed.connect(boost::bind(&QtView::update_view_state, this));
connect(&statusbar_timer_, SIGNAL(timeout()), this, SLOT(update_view_state_qt())); connect(&statusbar_timer_, SIGNAL(timeout()), this, SLOT(update_view_state_qt()));
focus_command_buffer.connect(boost::bind(&QtView::focus_command_widget, this));
commandbuffer_ = new QCommandBuffer(this, *controlcommand_);
addToolBar(commandbuffer_, Bottom, true);
// assign an icon to main form // assign an icon to main form
string const iconname = LibFileSearch("images", "lyx", "xpm"); string const iconname = LibFileSearch("images", "lyx", "xpm");
if (!iconname.empty()) if (!iconname.empty())
@ -84,6 +78,10 @@ QtView::QtView(unsigned int width, unsigned int height)
// make sure the buttons are disabled if needed // make sure the buttons are disabled if needed
updateToolbar(); updateToolbar();
// allowing the toolbars to tear off is too easily done,
// and we don't save their orientation anyway. Disable the handle.
setToolBarsMovable(false);
} }
@ -99,6 +97,13 @@ void QtView::setWindowTitle(string const & t, string const & it)
} }
void QtView::addCommandBuffer(QWidget * parent)
{
commandbuffer_ = new QCommandBuffer(this, parent, *controlcommand_);
focus_command_buffer.connect(boost::bind(&QtView::focus_command_widget, this));
}
void QtView::message(string const & str) void QtView::message(string const & str)
{ {
statusBar()->message(toqstr(str)); statusBar()->message(toqstr(str));
@ -115,7 +120,8 @@ void QtView::clearMessage()
void QtView::focus_command_widget() void QtView::focus_command_widget()
{ {
commandbuffer_->focus_command(); if (commandbuffer_)
commandbuffer_->focus_command();
} }

View File

@ -46,6 +46,9 @@ public:
/// clear status message /// clear status message
virtual void clearMessage(); virtual void clearMessage();
/// add the command buffer
void addCommandBuffer(QWidget * parent);
public slots: public slots:
/// menu item has been selected /// menu item has been selected
void activated(int id); void activated(int id);

View File

@ -203,9 +203,29 @@ void Toolbar::Pimpl::openLayoutList()
} }
namespace {
QMainWindow::ToolBarDock getPosition(ToolbarBackend::Flags const & flags)
{
if (flags & ToolbarBackend::TOP)
return QMainWindow::Top;
if (flags & ToolbarBackend::BOTTOM)
return QMainWindow::Bottom;
if (flags & ToolbarBackend::LEFT)
return QMainWindow::Left;
if (flags & ToolbarBackend::RIGHT)
return QMainWindow::Right;
return QMainWindow::Top;
}
};
void Toolbar::Pimpl::add(ToolbarBackend::Toolbar const & tb) void Toolbar::Pimpl::add(ToolbarBackend::Toolbar const & tb)
{ {
QToolBar * qtb = new QToolBar(qt_(tb.name), owner_); QToolBar * qtb = new QToolBar(qt_(tb.name), owner_, getPosition(tb.flags));
// give visual separation between adjacent toolbars
qtb->addSeparator();
ToolbarBackend::item_iterator it = tb.items.begin(); ToolbarBackend::item_iterator it = tb.items.begin();
ToolbarBackend::item_iterator end = tb.items.end(); ToolbarBackend::item_iterator end = tb.items.end();
@ -213,7 +233,7 @@ void Toolbar::Pimpl::add(ToolbarBackend::Toolbar const & tb)
add(qtb, it->first, it->second); add(qtb, it->first, it->second);
toolbars_[tb.name] = qtb; toolbars_[tb.name] = qtb;
displayToolbar(tb, tb.display_type == ToolbarBackend::ON); displayToolbar(tb, tb.flags & ToolbarBackend::ON);
} }
@ -235,6 +255,10 @@ void Toolbar::Pimpl::add(QToolBar * tb, int action, string const & tooltip)
proxy_.get(), SLOT(layout_selected(const QString &))); proxy_.get(), SLOT(layout_selected(const QString &)));
break; break;
} }
case ToolbarBackend::MINIBUFFER:
owner_->addCommandBuffer(tb);
tb->setHorizontalStretchable(true);
break;
default: { default: {
QPixmap p = QPixmap(toolbarbackend.getIcon(action).c_str()); QPixmap p = QPixmap(toolbarbackend.getIcon(action).c_str());
QToolButton * button = QToolButton * button =

View File

@ -1,3 +1,7 @@
2003-04-15 John Levon <levon@movementarian.org>
* Toolbar_pimpl.C: ignore Minibuffer
2003-04-10 John Levon <levon@movementarian.org> 2003-04-10 John Levon <levon@movementarian.org>
* XFormsView.C: * XFormsView.C:

View File

@ -287,8 +287,8 @@ void Toolbar::Pimpl::add(int action, string const & tooltip)
case ToolbarBackend::SEPARATOR: case ToolbarBackend::SEPARATOR:
xpos += sepspace; xpos += sepspace;
break; break;
case ToolbarBackend::NEWLINE: case ToolbarBackend::MINIBUFFER:
// Not supported yet. // Not implemented
break; break;
case ToolbarBackend::LAYOUTS: case ToolbarBackend::LAYOUTS:
xpos += standardspacing; xpos += standardspacing;