mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
patch from dekel and patch from angus
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@994 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9bb14183f4
commit
e1cd322547
35
ChangeLog
35
ChangeLog
@ -1,9 +1,44 @@
|
|||||||
|
2000-08-31 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
|
* src/converter.C: added some using directives
|
||||||
|
|
||||||
|
* src/frontends/ButtonPolicies.C: changes to overcome
|
||||||
|
"need lvalue" error with DEC c++
|
||||||
|
|
||||||
|
* src/frontends/xforms/FormDocument.C (c-tor): use C callback
|
||||||
|
to WMHideCB for DEC c++
|
||||||
|
|
||||||
|
* src/frontends/xforms/Menubar_pimpl.C: added using directive
|
||||||
|
|
||||||
|
* src/frontends/xforms/forms/form_document.C.patch: use C callback
|
||||||
|
to BulletBMTableCB for DEC c++
|
||||||
|
|
||||||
2000-08-31 Allan Rae <rae@lyx.org>
|
2000-08-31 Allan Rae <rae@lyx.org>
|
||||||
|
|
||||||
* src/lyx_gui.C (create_forms): build combo_language2 which is part of
|
* src/lyx_gui.C (create_forms): build combo_language2 which is part of
|
||||||
character dialog separately from old document dialogs combo_language.
|
character dialog separately from old document dialogs combo_language.
|
||||||
Stops a segfault.
|
Stops a segfault.
|
||||||
|
|
||||||
|
2000-08-30 Dekel Tsur <dekel@math.tau.ac.il>
|
||||||
|
|
||||||
|
* src/commandtags.h: Added LFUN_GOTO_PARAGRAPH.
|
||||||
|
Removed LFUN_REF_CREATE.
|
||||||
|
|
||||||
|
* src/MenuBackend.C: Added new tags: toc and references
|
||||||
|
|
||||||
|
* src/frontends/xforms/Menubar_pimpl.C: Removed the use of StrPool
|
||||||
|
(add_lastfiles, add_documents, add_formats): Removed the unused smn
|
||||||
|
parameter.
|
||||||
|
(add_toc, add_references): New methods.
|
||||||
|
(create_submenu): Handle correctly the case when there is a
|
||||||
|
seperator after optional menu items.
|
||||||
|
|
||||||
|
* src/lyxfunc.C (getStatus): Handle LFUN_REF_BACK.
|
||||||
|
(dispatch): Combined the code for LFUN_REF_CREATE and LFUN_REF_INSERT.
|
||||||
|
(dispatch): New code for LFUN_GOTO_PARAGRAPH.
|
||||||
|
|
||||||
|
* src/frontends/xforms/FormToc.C (apply): Use Dispatch.
|
||||||
|
|
||||||
2000-08-30 Dekel Tsur <dekel@math.tau.ac.il>
|
2000-08-30 Dekel Tsur <dekel@math.tau.ac.il>
|
||||||
|
|
||||||
* src/converter.[Ch]: New file for converting between different
|
* src/converter.[Ch]: New file for converting between different
|
||||||
|
@ -8,6 +8,8 @@ Menuset
|
|||||||
Menubar "main"
|
Menubar "main"
|
||||||
Submenu "File|F" "file"
|
Submenu "File|F" "file"
|
||||||
Submenu "Edit|E" "edit"
|
Submenu "Edit|E" "edit"
|
||||||
|
Submenu "Toc|T" "toc"
|
||||||
|
Submenu "Refs|R" "refs"
|
||||||
Submenu "Layout|L" "layout"
|
Submenu "Layout|L" "layout"
|
||||||
Submenu "Insert|I" "insert"
|
Submenu "Insert|I" "insert"
|
||||||
Submenu "Math|M" "math"
|
Submenu "Math|M" "math"
|
||||||
@ -153,6 +155,16 @@ Menuset
|
|||||||
OptItem "Show History|H" "vc-history"
|
OptItem "Show History|H" "vc-history"
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Menu toc
|
||||||
|
Toc
|
||||||
|
End
|
||||||
|
|
||||||
|
Menu refs
|
||||||
|
References
|
||||||
|
Separator
|
||||||
|
Item "Go Back|B" "reference-back"
|
||||||
|
End
|
||||||
|
|
||||||
Menu "layout"
|
Menu "layout"
|
||||||
Item "Character...|C" "layout-character"
|
Item "Character...|C" "layout-character"
|
||||||
Item "Paragraph...|P" "layout-paragraph"
|
Item "Paragraph...|P" "layout-paragraph"
|
||||||
|
@ -343,6 +343,8 @@ void LyXAction::init()
|
|||||||
N_("Go one paragraph down"), ReadOnly },
|
N_("Go one paragraph down"), ReadOnly },
|
||||||
{ LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select",
|
{ LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select",
|
||||||
N_("Select next paragraph"), ReadOnly },
|
N_("Select next paragraph"), ReadOnly },
|
||||||
|
{ LFUN_GOTO_PARAGRAPH, "paragraph-goto",
|
||||||
|
N_("Go to paragraph"), ReadOnly },
|
||||||
{ LFUN_UP_PARAGRAPH, "paragraph-up",
|
{ LFUN_UP_PARAGRAPH, "paragraph-up",
|
||||||
N_("Go one paragraph up"), ReadOnly },
|
N_("Go one paragraph up"), ReadOnly },
|
||||||
{ LFUN_UP_PARAGRAPHSEL, "paragraph-up-select",
|
{ LFUN_UP_PARAGRAPHSEL, "paragraph-up-select",
|
||||||
@ -362,7 +364,7 @@ void LyXAction::init()
|
|||||||
{ LFUN_REDO, "redo", N_("Redo"), Noop },
|
{ LFUN_REDO, "redo", N_("Redo"), Noop },
|
||||||
{ LFUN_REF_BACK, "reference-back", "", ReadOnly },
|
{ LFUN_REF_BACK, "reference-back", "", ReadOnly },
|
||||||
{ LFUN_REF_GOTO, "reference-goto", "", ReadOnly },
|
{ LFUN_REF_GOTO, "reference-goto", "", ReadOnly },
|
||||||
{ LFUN_REF_CREATE, "reference-insert",
|
{ LFUN_REF_INSERT, "reference-insert",
|
||||||
N_("Insert cross reference"), ReadOnly },
|
N_("Insert cross reference"), ReadOnly },
|
||||||
{ LFUN_NEXT, "screen-down", "", ReadOnly },
|
{ LFUN_NEXT, "screen-down", "", ReadOnly },
|
||||||
{ LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
|
{ LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
|
||||||
|
@ -38,6 +38,8 @@ MenuItem::MenuItem(Kind kind, string const & label,
|
|||||||
case Separator:
|
case Separator:
|
||||||
case Documents:
|
case Documents:
|
||||||
case Lastfiles:
|
case Lastfiles:
|
||||||
|
case Toc:
|
||||||
|
case References:
|
||||||
case ViewFormats:
|
case ViewFormats:
|
||||||
case UpdateFormats:
|
case UpdateFormats:
|
||||||
case ExportFormats:
|
case ExportFormats:
|
||||||
@ -76,8 +78,10 @@ Menu & Menu::read(LyXLex & lex)
|
|||||||
md_exportformats,
|
md_exportformats,
|
||||||
md_lastfiles,
|
md_lastfiles,
|
||||||
md_optitem,
|
md_optitem,
|
||||||
md_submenu,
|
md_references,
|
||||||
md_separator,
|
md_separator,
|
||||||
|
md_submenu,
|
||||||
|
md_toc,
|
||||||
md_updateformats,
|
md_updateformats,
|
||||||
md_viewformats,
|
md_viewformats,
|
||||||
md_last
|
md_last
|
||||||
@ -90,8 +94,10 @@ Menu & Menu::read(LyXLex & lex)
|
|||||||
{ "item", md_item },
|
{ "item", md_item },
|
||||||
{ "lastfiles", md_lastfiles },
|
{ "lastfiles", md_lastfiles },
|
||||||
{ "optitem", md_optitem },
|
{ "optitem", md_optitem },
|
||||||
|
{ "references", md_references },
|
||||||
{ "separator", md_separator },
|
{ "separator", md_separator },
|
||||||
{ "submenu", md_submenu },
|
{ "submenu", md_submenu },
|
||||||
|
{ "toc", md_toc },
|
||||||
{ "updateformats", md_updateformats },
|
{ "updateformats", md_updateformats },
|
||||||
{ "viewformats", md_viewformats }
|
{ "viewformats", md_viewformats }
|
||||||
};
|
};
|
||||||
@ -120,24 +126,39 @@ Menu & Menu::read(LyXLex & lex)
|
|||||||
optional = false;
|
optional = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case md_separator:
|
case md_separator:
|
||||||
add(MenuItem(MenuItem::Separator));
|
add(MenuItem(MenuItem::Separator));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case md_lastfiles:
|
case md_lastfiles:
|
||||||
add(MenuItem(MenuItem::Lastfiles));
|
add(MenuItem(MenuItem::Lastfiles));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case md_documents:
|
case md_documents:
|
||||||
add(MenuItem(MenuItem::Documents));
|
add(MenuItem(MenuItem::Documents));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case md_toc:
|
||||||
|
add(MenuItem(MenuItem::Toc));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case md_references:
|
||||||
|
add(MenuItem(MenuItem::References));
|
||||||
|
break;
|
||||||
|
|
||||||
case md_viewformats:
|
case md_viewformats:
|
||||||
add(MenuItem(MenuItem::ViewFormats));
|
add(MenuItem(MenuItem::ViewFormats));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case md_updateformats:
|
case md_updateformats:
|
||||||
add(MenuItem(MenuItem::UpdateFormats));
|
add(MenuItem(MenuItem::UpdateFormats));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case md_exportformats:
|
case md_exportformats:
|
||||||
add(MenuItem(MenuItem::ExportFormats));
|
add(MenuItem(MenuItem::ExportFormats));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case md_submenu: {
|
case md_submenu: {
|
||||||
lex.next();
|
lex.next();
|
||||||
char * tmp = strdup(lex.GetString().c_str());
|
char * tmp = strdup(lex.GetString().c_str());
|
||||||
@ -148,9 +169,11 @@ Menu & Menu::read(LyXLex & lex)
|
|||||||
add(MenuItem(MenuItem::Submenu, mlabel, mname));
|
add(MenuItem(MenuItem::Submenu, mlabel, mname));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case md_endmenu:
|
case md_endmenu:
|
||||||
quit = true;
|
quit = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
lex.printError("menubar::read: "
|
lex.printError("menubar::read: "
|
||||||
"Unknown menu tag: `$$Token'");
|
"Unknown menu tag: `$$Token'");
|
||||||
|
@ -41,6 +41,10 @@ public:
|
|||||||
/** This is the list of opened Documents,
|
/** This is the list of opened Documents,
|
||||||
typically for the Documents menu. */
|
typically for the Documents menu. */
|
||||||
Documents,
|
Documents,
|
||||||
|
///
|
||||||
|
Toc,
|
||||||
|
///
|
||||||
|
References,
|
||||||
/** This is a list of viewable formats
|
/** This is a list of viewable formats
|
||||||
typically for the Documents menu. */
|
typically for the Documents menu. */
|
||||||
ViewFormats,
|
ViewFormats,
|
||||||
@ -103,6 +107,8 @@ public:
|
|||||||
///
|
///
|
||||||
bool empty() const { return items_.empty(); }
|
bool empty() const { return items_.empty(); }
|
||||||
///
|
///
|
||||||
|
ItemList::size_type size() const { return items_.size(); }
|
||||||
|
///
|
||||||
const_iterator begin() const {
|
const_iterator begin() const {
|
||||||
return items_.begin();
|
return items_.begin();
|
||||||
}
|
}
|
||||||
|
@ -282,9 +282,9 @@ enum kb_action {
|
|||||||
LFUN_SCROLL_INSET, // Jug 20000801
|
LFUN_SCROLL_INSET, // Jug 20000801
|
||||||
LFUN_UPDATE, // Dekel 20000805
|
LFUN_UPDATE, // Dekel 20000805
|
||||||
LFUN_INDEX_INSERT, // Angus 20000803
|
LFUN_INDEX_INSERT, // Angus 20000803
|
||||||
LFUN_REF_CREATE, // Angus 20000807
|
|
||||||
LFUN_SCREEN_FONT_UPDATE, // ARRae 20000813
|
LFUN_SCREEN_FONT_UPDATE, // ARRae 20000813
|
||||||
LFUN_DIALOG_TABULAR_INSERT, // Jug 20000825 (old table-insert)
|
LFUN_DIALOG_TABULAR_INSERT, // Jug 20000825 (old table-insert)
|
||||||
|
LFUN_GOTO_PARAGRAPH, // Dekel 20000826
|
||||||
LFUN_LASTACTION /* this marks the end of the table */
|
LFUN_LASTACTION /* this marks the end of the table */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,7 +36,10 @@
|
|||||||
using std::map;
|
using std::map;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::queue;
|
using std::queue;
|
||||||
|
using std::pair;
|
||||||
|
using std::sort;
|
||||||
using std::stack;
|
using std::stack;
|
||||||
|
using std::endl;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -20,6 +20,13 @@
|
|||||||
#include "ButtonPolicies.h"
|
#include "ButtonPolicies.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
// These shenanigans needed or DEC c++ complains that expression must
|
||||||
|
// be an lvalue
|
||||||
|
static const int sum_ = ( PreferencesPolicy::OKAY |
|
||||||
|
PreferencesPolicy::APPLY |
|
||||||
|
PreferencesPolicy::CANCEL |
|
||||||
|
PreferencesPolicy::UNDO_ALL );
|
||||||
|
static const PreferencesPolicy::State bogus_ = PreferencesPolicy::BOGUS;
|
||||||
|
|
||||||
// Helper function
|
// Helper function
|
||||||
inline void nextState(ButtonPolicy::State & state,
|
inline void nextState(ButtonPolicy::State & state,
|
||||||
@ -47,10 +54,10 @@ inline void nextState(ButtonPolicy::State & state,
|
|||||||
PreferencesPolicy::PreferencesPolicy()
|
PreferencesPolicy::PreferencesPolicy()
|
||||||
: state_(INITIAL),
|
: state_(INITIAL),
|
||||||
outputs_(APPLIED+1,
|
outputs_(APPLIED+1,
|
||||||
static_cast<int const &>(OKAY | APPLY | CANCEL | UNDO_ALL)),
|
static_cast<int const &>( sum_ )),
|
||||||
state_machine_(APPLIED+1,
|
state_machine_(APPLIED+1,
|
||||||
StateArray(SMI_TOTAL,
|
StateArray(SMI_TOTAL,
|
||||||
static_cast<State const &>(BOGUS)))
|
static_cast<State const &>( bogus_ )))
|
||||||
{
|
{
|
||||||
// Build the state output map
|
// Build the state output map
|
||||||
outputs_[INITIAL] = CLOSE;
|
outputs_[INITIAL] = CLOSE;
|
||||||
@ -122,10 +129,10 @@ void PreferencesPolicy::input(SMInput input)
|
|||||||
OkCancelPolicy::OkCancelPolicy()
|
OkCancelPolicy::OkCancelPolicy()
|
||||||
: state_(INITIAL),
|
: state_(INITIAL),
|
||||||
outputs_(INVALID+1,
|
outputs_(INVALID+1,
|
||||||
static_cast<int const &>(OKAY | APPLY | CANCEL | UNDO_ALL)),
|
static_cast<int const &>( sum_ )),
|
||||||
state_machine_(INVALID+1,
|
state_machine_(INVALID+1,
|
||||||
StateArray(SMI_TOTAL,
|
StateArray(SMI_TOTAL,
|
||||||
static_cast<State const &>(BOGUS)))
|
static_cast<State const &>( bogus_ )))
|
||||||
{
|
{
|
||||||
// Build the state output map
|
// Build the state output map
|
||||||
outputs_[INITIAL] = CLOSE;
|
outputs_[INITIAL] = CLOSE;
|
||||||
@ -177,10 +184,10 @@ void OkCancelPolicy::input(SMInput input)
|
|||||||
OkCancelReadOnlyPolicy::OkCancelReadOnlyPolicy()
|
OkCancelReadOnlyPolicy::OkCancelReadOnlyPolicy()
|
||||||
: state_(INITIAL),
|
: state_(INITIAL),
|
||||||
outputs_(RO_INVALID+1,
|
outputs_(RO_INVALID+1,
|
||||||
static_cast<int const &>(OKAY | APPLY | CANCEL | UNDO_ALL)),
|
static_cast<int const &>( sum_ )),
|
||||||
state_machine_(RO_INVALID+1,
|
state_machine_(RO_INVALID+1,
|
||||||
StateArray(SMI_TOTAL,
|
StateArray(SMI_TOTAL,
|
||||||
static_cast<State const &>(BOGUS)))
|
static_cast<State const &>( bogus_ )))
|
||||||
{
|
{
|
||||||
// Build the state output map
|
// Build the state output map
|
||||||
outputs_[INITIAL] = CLOSE;
|
outputs_[INITIAL] = CLOSE;
|
||||||
@ -254,10 +261,10 @@ void OkCancelReadOnlyPolicy::input(SMInput input)
|
|||||||
NoRepeatedApplyReadOnlyPolicy::NoRepeatedApplyReadOnlyPolicy()
|
NoRepeatedApplyReadOnlyPolicy::NoRepeatedApplyReadOnlyPolicy()
|
||||||
: state_(INITIAL),
|
: state_(INITIAL),
|
||||||
outputs_(RO_INVALID+1,
|
outputs_(RO_INVALID+1,
|
||||||
static_cast<int const &>(OKAY | APPLY | CANCEL | UNDO_ALL)),
|
static_cast<int const &>( sum_ )),
|
||||||
state_machine_(RO_INVALID+1,
|
state_machine_(RO_INVALID+1,
|
||||||
StateArray(SMI_TOTAL,
|
StateArray(SMI_TOTAL,
|
||||||
static_cast<State const &>(BOGUS)))
|
static_cast<State const &>( bogus_ )))
|
||||||
{
|
{
|
||||||
// Build the state output map
|
// Build the state output map
|
||||||
outputs_[INITIAL] = CLOSE;
|
outputs_[INITIAL] = CLOSE;
|
||||||
@ -332,10 +339,10 @@ void NoRepeatedApplyReadOnlyPolicy::input(SMInput input)
|
|||||||
OkApplyCancelReadOnlyPolicy::OkApplyCancelReadOnlyPolicy()
|
OkApplyCancelReadOnlyPolicy::OkApplyCancelReadOnlyPolicy()
|
||||||
: state_(INITIAL),
|
: state_(INITIAL),
|
||||||
outputs_(RO_APPLIED+1,
|
outputs_(RO_APPLIED+1,
|
||||||
static_cast<int const &>(OKAY | APPLY | CANCEL | UNDO_ALL)),
|
static_cast<int const &>( sum_ )),
|
||||||
state_machine_(RO_APPLIED+1,
|
state_machine_(RO_APPLIED+1,
|
||||||
StateArray(SMI_TOTAL,
|
StateArray(SMI_TOTAL,
|
||||||
static_cast<State const &>(BOGUS)))
|
static_cast<State const &>( bogus_ )))
|
||||||
{
|
{
|
||||||
// Build the state output map
|
// Build the state output map
|
||||||
outputs_[INITIAL] = CLOSE;
|
outputs_[INITIAL] = CLOSE;
|
||||||
@ -424,10 +431,10 @@ void OkApplyCancelReadOnlyPolicy::input(SMInput input)
|
|||||||
OkApplyCancelPolicy::OkApplyCancelPolicy()
|
OkApplyCancelPolicy::OkApplyCancelPolicy()
|
||||||
: state_(INITIAL),
|
: state_(INITIAL),
|
||||||
outputs_(APPLIED+1,
|
outputs_(APPLIED+1,
|
||||||
static_cast<int const &>(OKAY | APPLY | CANCEL | UNDO_ALL)),
|
static_cast<int const &>( sum_ )),
|
||||||
state_machine_(APPLIED+1,
|
state_machine_(APPLIED+1,
|
||||||
StateArray(SMI_TOTAL,
|
StateArray(SMI_TOTAL,
|
||||||
static_cast<State const &>(BOGUS)))
|
static_cast<State const &>( bogus_ )))
|
||||||
{
|
{
|
||||||
// Build the state output map
|
// Build the state output map
|
||||||
outputs_[INITIAL] = CLOSE;
|
outputs_[INITIAL] = CLOSE;
|
||||||
@ -490,10 +497,10 @@ void OkApplyCancelPolicy::input(SMInput input)
|
|||||||
NoRepeatedApplyPolicy::NoRepeatedApplyPolicy()
|
NoRepeatedApplyPolicy::NoRepeatedApplyPolicy()
|
||||||
: state_(INITIAL),
|
: state_(INITIAL),
|
||||||
outputs_(INVALID+1,
|
outputs_(INVALID+1,
|
||||||
static_cast<int const &>(OKAY | APPLY | CANCEL | UNDO_ALL)),
|
static_cast<int const &>( sum_ )),
|
||||||
state_machine_(INVALID+1,
|
state_machine_(INVALID+1,
|
||||||
StateArray(SMI_TOTAL,
|
StateArray(SMI_TOTAL,
|
||||||
static_cast<State const &>(BOGUS)))
|
static_cast<State const &>( bogus_ )))
|
||||||
{
|
{
|
||||||
// Build the state output map
|
// Build the state output map
|
||||||
outputs_[INITIAL] = CLOSE;
|
outputs_[INITIAL] = CLOSE;
|
||||||
|
@ -224,7 +224,7 @@ void FormDocument::build()
|
|||||||
fl_set_input_maxchars(bullets_->input_bullet_latex, 80);
|
fl_set_input_maxchars(bullets_->input_bullet_latex, 80);
|
||||||
|
|
||||||
fl_set_form_atclose(dialog_->form,
|
fl_set_form_atclose(dialog_->form,
|
||||||
FormDocument::WMHideCB, 0);
|
C_FormDocumentWMHideCB, 0);
|
||||||
fl_addto_tabfolder(dialog_->tabbed_folder,_("Document"),
|
fl_addto_tabfolder(dialog_->tabbed_folder,_("Document"),
|
||||||
class_->form);
|
class_->form);
|
||||||
fl_addto_tabfolder(dialog_->tabbed_folder,_("Paper"),
|
fl_addto_tabfolder(dialog_->tabbed_folder,_("Paper"),
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "form_toc.h"
|
#include "form_toc.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
|
#include "lyxfunc.h"
|
||||||
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
FormToc::FormToc(LyXView * lv, Dialogs * d)
|
FormToc::FormToc(LyXView * lv, Dialogs * d)
|
||||||
: FormCommand(lv, d, _("Table of Contents")), dialog_(0)
|
: FormCommand(lv, d, _("Table of Contents")), dialog_(0)
|
||||||
@ -146,10 +148,7 @@ void FormToc::apply()
|
|||||||
|
|
||||||
unsigned int choice = fl_get_browser( dialog_->browser );
|
unsigned int choice = fl_get_browser( dialog_->browser );
|
||||||
if (0 < choice && choice - 1 < toclist.size()) {
|
if (0 < choice && choice - 1 < toclist.size()) {
|
||||||
lv_->view()->beforeChange();
|
string tmp = tostr(toclist[choice-1].par->id());
|
||||||
lv_->view()->text->SetCursor( lv_->view(), toclist[choice-1].par, 0 );
|
lv_->getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp.c_str());
|
||||||
lv_->view()->text->sel_cursor =
|
|
||||||
lv_->view()->text->cursor;
|
|
||||||
lv_->view()->update(BufferView::SELECT|BufferView::FITCUR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/StrPool.h"
|
|
||||||
#include "support/LAssert.h"
|
#include "support/LAssert.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "LyXAction.h"
|
#include "LyXAction.h"
|
||||||
@ -30,7 +29,11 @@
|
|||||||
#include "Menubar_pimpl.h"
|
#include "Menubar_pimpl.h"
|
||||||
#include "exporter.h"
|
#include "exporter.h"
|
||||||
|
|
||||||
|
using std::pair;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
typedef vector<int>::size_type size_type;
|
||||||
|
|
||||||
extern kb_keymap * toplevel_keymap;
|
extern kb_keymap * toplevel_keymap;
|
||||||
extern LyXAction lyxaction;
|
extern LyXAction lyxaction;
|
||||||
@ -219,9 +222,7 @@ void Menubar::Pimpl::openByName(string const & name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menubar::Pimpl::add_lastfiles(int menu, string const & extra_label,
|
void Menubar::Pimpl::add_lastfiles(int menu, string const & extra_label)
|
||||||
std::vector<int> & /*smn*/,
|
|
||||||
StrPool & strpool)
|
|
||||||
{
|
{
|
||||||
int ii = 1;
|
int ii = 1;
|
||||||
for (LastFiles::const_iterator cit = lastfiles->begin();
|
for (LastFiles::const_iterator cit = lastfiles->begin();
|
||||||
@ -238,23 +239,21 @@ void Menubar::Pimpl::add_lastfiles(int menu, string const & extra_label,
|
|||||||
lyxerr[Debug::GUI] << "shortcut is " << shortcut <<
|
lyxerr[Debug::GUI] << "shortcut is " << shortcut <<
|
||||||
endl;
|
endl;
|
||||||
|
|
||||||
fl_addtopup(menu, strpool.add(label), strpool.add(shortcut));
|
fl_addtopup(menu, label.c_str(), shortcut.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menubar::Pimpl::add_documents(int menu, string const & extra_label,
|
void Menubar::Pimpl::add_documents(int menu, string const & extra_label)
|
||||||
std::vector<int> & /*smn*/,
|
|
||||||
StrPool & strpool)
|
|
||||||
{
|
{
|
||||||
std::vector<string> names = bufferlist.getFileNames();
|
vector<string> names = bufferlist.getFileNames();
|
||||||
|
|
||||||
if (names.empty()) {
|
if (names.empty()) {
|
||||||
fl_addtopup(menu,_("No Documents Open!%i"));
|
fl_addtopup(menu,_("No Documents Open!%i"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<string>::const_iterator cit = names.begin();
|
for (vector<string>::const_iterator cit = names.begin();
|
||||||
cit != names.end() ; ++cit) {
|
cit != names.end() ; ++cit) {
|
||||||
int action =
|
int action =
|
||||||
lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *cit);
|
lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *cit);
|
||||||
@ -263,23 +262,285 @@ void Menubar::Pimpl::add_documents(int menu, string const & extra_label,
|
|||||||
if ((cit + 1) == names.end())
|
if ((cit + 1) == names.end())
|
||||||
label += extra_label;
|
label += extra_label;
|
||||||
|
|
||||||
fl_addtopup(menu, strpool.add(label));
|
fl_addtopup(menu, label.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string limit_string_length(string const & str)
|
||||||
|
{
|
||||||
|
string::size_type const max_item_length = 45;
|
||||||
|
|
||||||
|
if (str.size() > max_item_length)
|
||||||
|
return str.substr(0, max_item_length-3) + "...";
|
||||||
|
else
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_type const max_number_of_menus = 32;
|
||||||
|
size_type const max_number_of_items = 25;
|
||||||
|
|
||||||
|
void add_toc2(int menu, string const & extra_label,
|
||||||
|
vector<int> & smn, Window win,
|
||||||
|
vector<Buffer::TocItem> const & toc_list,
|
||||||
|
size_type from, size_type to, int depth)
|
||||||
|
{
|
||||||
|
if (to - from <= max_number_of_items) {
|
||||||
|
for (size_type i = from; i < to; ++i) {
|
||||||
|
int action = lyxaction.
|
||||||
|
getPseudoAction(LFUN_GOTO_PARAGRAPH,
|
||||||
|
tostr(toc_list[i].par->id()));
|
||||||
|
string label(4 * max(0, toc_list[i].depth - depth),' ');
|
||||||
|
label += toc_list[i].str;
|
||||||
|
label = limit_string_length(label);
|
||||||
|
label += "%x" + tostr(action);
|
||||||
|
if (i == to - 1 && depth == 0)
|
||||||
|
label += extra_label;
|
||||||
|
fl_addtopup(menu, label.c_str());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
size_type pos = from;
|
||||||
|
size_type count = 0;
|
||||||
|
while (pos < to) {
|
||||||
|
++count;
|
||||||
|
if (count > max_number_of_items) {
|
||||||
|
fl_addtopup(menu, ". . .%d");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
size_type new_pos = pos+1;
|
||||||
|
while (new_pos < to &&
|
||||||
|
toc_list[new_pos].depth > depth)
|
||||||
|
++new_pos;
|
||||||
|
|
||||||
|
int action = lyxaction.
|
||||||
|
getPseudoAction(LFUN_GOTO_PARAGRAPH,
|
||||||
|
tostr(toc_list[pos].par->id()));
|
||||||
|
string label(4 * max(0, toc_list[pos].depth - depth), ' ');
|
||||||
|
label += toc_list[pos].str;
|
||||||
|
label = limit_string_length(label);
|
||||||
|
if (new_pos == to && depth == 0)
|
||||||
|
label += extra_label;
|
||||||
|
|
||||||
|
if (new_pos == pos + 1) {
|
||||||
|
label += "%x" + tostr(action);
|
||||||
|
fl_addtopup(menu, label.c_str());
|
||||||
|
} else if (smn.size() < max_number_of_menus) {
|
||||||
|
int menu2 = fl_newpup(win);
|
||||||
|
smn.push_back(menu2);
|
||||||
|
add_toc2(menu2, extra_label, smn, win,
|
||||||
|
toc_list, pos, new_pos, depth+1);
|
||||||
|
label += "%m";
|
||||||
|
fl_addtopup(menu, label.c_str(), menu2);
|
||||||
|
} else {
|
||||||
|
label += "%d";
|
||||||
|
fl_addtopup(menu, label.c_str());
|
||||||
|
}
|
||||||
|
pos = new_pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
|
||||||
|
vector<int> & smn, Window win)
|
||||||
|
{
|
||||||
|
//xgettext:no-c-format
|
||||||
|
static char const * MenuNames[3] = { N_("List of Figures%m"),
|
||||||
|
//xgettext:no-c-format
|
||||||
|
N_("List of Tables%m"),
|
||||||
|
//xgettext:no-c-format
|
||||||
|
N_("List of Algorithms%m") };
|
||||||
|
|
||||||
|
vector<vector<Buffer::TocItem> > toc_list =
|
||||||
|
owner_->buffer()->getTocList();
|
||||||
|
|
||||||
|
// Handle LOF/LOT/LOA
|
||||||
|
int max_nonempty = 0;
|
||||||
|
for (int i = 1; i <= 3; ++i)
|
||||||
|
if (!toc_list[i].empty())
|
||||||
|
max_nonempty = i;
|
||||||
|
|
||||||
|
for (int j = 1; j <= 3; ++j)
|
||||||
|
if (!toc_list[j].empty()) {
|
||||||
|
int menu2 = fl_newpup(win);
|
||||||
|
smn.push_back(menu2);
|
||||||
|
for (size_type i = 0; i < toc_list[j].size(); ++i) {
|
||||||
|
if (i > max_number_of_items) {
|
||||||
|
fl_addtopup(menu2, ". . .%d");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int action = lyxaction.
|
||||||
|
getPseudoAction(LFUN_GOTO_PARAGRAPH,
|
||||||
|
tostr(toc_list[j][i].par->id()));
|
||||||
|
string label =
|
||||||
|
limit_string_length(toc_list[j][i].str);
|
||||||
|
label += "%x" + tostr(action);
|
||||||
|
fl_addtopup(menu2, label.c_str());
|
||||||
|
}
|
||||||
|
if (j == max_nonempty) {
|
||||||
|
string label = _(MenuNames[j-1]);
|
||||||
|
label += "%l";
|
||||||
|
fl_addtopup(menu, label.c_str(), menu2);
|
||||||
|
} else
|
||||||
|
fl_addtopup(menu, _(MenuNames[j-1]), menu2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle normal TOC
|
||||||
|
if (max_nonempty == 0 && toc_list[0].empty()) {
|
||||||
|
fl_addtopup(menu,_("No Table of Contents%i"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_toc2(menu, extra_label, smn, win,
|
||||||
|
toc_list[0], 0, toc_list[0].size(), 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void add_references2(int menu, vector<int> & smn, Window win,
|
||||||
|
vector<string> const & label_list, string const & type)
|
||||||
|
{
|
||||||
|
size_type const max_number_of_items = 25;
|
||||||
|
size_type const max_number_of_items2 = 20;
|
||||||
|
string::size_type const max_item_length = 40;
|
||||||
|
string::size_type const max_item_length2 = 20;
|
||||||
|
|
||||||
|
if (label_list.size() <= max_number_of_items)
|
||||||
|
for (size_type i = 0; i < label_list.size(); ++i) {
|
||||||
|
int action = (type == "goto")
|
||||||
|
? lyxaction.getPseudoAction(LFUN_REF_GOTO,
|
||||||
|
label_list[i])
|
||||||
|
: lyxaction.getPseudoAction(LFUN_REF_INSERT,
|
||||||
|
type + "|++||++|"
|
||||||
|
+ label_list[i]);
|
||||||
|
string label = label_list[i];
|
||||||
|
if (label.size() > max_item_length)
|
||||||
|
label = label.substr(0, max_item_length-1) + "$";
|
||||||
|
label += "%x" + tostr(action);
|
||||||
|
fl_addtopup(menu, label.c_str());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
size_type count = 0;
|
||||||
|
for (size_type i = 0; i < label_list.size();
|
||||||
|
i += max_number_of_items2) {
|
||||||
|
++count;
|
||||||
|
if (count > max_number_of_items) {
|
||||||
|
fl_addtopup(menu, ". . .%d");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
size_type j = min(label_list.size(),
|
||||||
|
i+max_number_of_items2);
|
||||||
|
|
||||||
|
string label;
|
||||||
|
label += (label_list[i].size() > max_item_length2)
|
||||||
|
? label_list[i].substr(0, max_item_length2-1) + "$"
|
||||||
|
: label_list[i];
|
||||||
|
label += "..";
|
||||||
|
label += (label_list[j-1].size() > max_item_length2)
|
||||||
|
? label_list[j-1].substr(0, max_item_length2-1) + "$"
|
||||||
|
: label += label_list[j-1];
|
||||||
|
|
||||||
|
if (smn.size() < max_number_of_menus) {
|
||||||
|
int menu2 = fl_newpup(win);
|
||||||
|
smn.push_back(menu2);
|
||||||
|
for (size_type k = i; k < j; ++k) {
|
||||||
|
int action = (type == "goto")
|
||||||
|
? lyxaction.getPseudoAction(LFUN_REF_GOTO,
|
||||||
|
label_list[k])
|
||||||
|
: lyxaction.getPseudoAction(LFUN_REF_INSERT,
|
||||||
|
type + "|++||++|"
|
||||||
|
+ label_list[k]);
|
||||||
|
string label2 = label_list[k];
|
||||||
|
if (label2.size() > max_item_length)
|
||||||
|
label2 = label2.substr(0, max_item_length-1) + "$";
|
||||||
|
label2 += "%x" + tostr(action);
|
||||||
|
fl_addtopup(menu2, label2.c_str());
|
||||||
|
}
|
||||||
|
label += "%m";
|
||||||
|
fl_addtopup(menu, label.c_str(), menu2);
|
||||||
|
} else {
|
||||||
|
label += "%d";
|
||||||
|
fl_addtopup(menu, label.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Menubar::Pimpl::add_references(int menu, string const & extra_label,
|
||||||
|
vector<int> & smn, Window win)
|
||||||
|
{
|
||||||
|
//xgettext:no-c-format
|
||||||
|
static char const * MenuNames[6] = { N_("Insert Reference%m"),
|
||||||
|
//xgettext:no-c-format
|
||||||
|
N_("Insert Page Number%m"),
|
||||||
|
//xgettext:no-c-format
|
||||||
|
N_("Insert vref%m"),
|
||||||
|
//xgettext:no-c-format
|
||||||
|
N_("Insert vpageref%m"),
|
||||||
|
//xgettext:no-c-format
|
||||||
|
N_("Insert Pretty Ref%m"),
|
||||||
|
//xgettext:no-c-format
|
||||||
|
N_("Goto Reference%m") };
|
||||||
|
|
||||||
|
int const EMPTY = 1;
|
||||||
|
int const SGML = 2;
|
||||||
|
int const READONLY = 4;
|
||||||
|
|
||||||
|
static int MenuFlags[6] = {
|
||||||
|
EMPTY | READONLY,
|
||||||
|
EMPTY | READONLY,
|
||||||
|
EMPTY | READONLY | SGML,
|
||||||
|
EMPTY | READONLY | SGML,
|
||||||
|
EMPTY | READONLY | SGML,
|
||||||
|
EMPTY };
|
||||||
|
|
||||||
|
static string const MenuTypes[6] = {
|
||||||
|
"ref", "pageref", "vref", "vpageref", "prettyref", "goto" };
|
||||||
|
|
||||||
|
vector<string> label_list = owner_->buffer()->getLabelList();
|
||||||
|
|
||||||
|
int flag = 0;
|
||||||
|
if (label_list.empty())
|
||||||
|
flag += EMPTY;
|
||||||
|
if (owner_->buffer()->isSGML())
|
||||||
|
flag += SGML;
|
||||||
|
if (owner_->buffer()->isReadonly())
|
||||||
|
flag += READONLY;
|
||||||
|
|
||||||
|
int max_nonempty = -1;
|
||||||
|
for (int i = 0; i < 6; ++i)
|
||||||
|
if ((MenuFlags[i] & flag) == 0)
|
||||||
|
max_nonempty = i;
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; ++i) {
|
||||||
|
if ((MenuFlags[i] & flag) == 0) {
|
||||||
|
string label = _(MenuNames[i]);
|
||||||
|
if (i == max_nonempty)
|
||||||
|
label += extra_label;
|
||||||
|
if (smn.size() < max_number_of_menus) {
|
||||||
|
int menu2 = fl_newpup(win);
|
||||||
|
smn.push_back(menu2);
|
||||||
|
add_references2(menu2, smn, win, label_list,
|
||||||
|
MenuTypes[i]);
|
||||||
|
fl_addtopup(menu, label.c_str(), menu2);
|
||||||
|
} else {
|
||||||
|
label += "%d";
|
||||||
|
fl_addtopup(menu, label.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menubar::Pimpl::add_formats(int menu, string const & extra_label,
|
void Menubar::Pimpl::add_formats(int menu, string const & extra_label,
|
||||||
std::vector<int> & /*smn*/,
|
|
||||||
StrPool & strpool,
|
|
||||||
kb_action action, bool viewable)
|
kb_action action, bool viewable)
|
||||||
{
|
{
|
||||||
std::vector<pair<string,string> > names =
|
vector<pair<string,string> > names =
|
||||||
viewable
|
viewable
|
||||||
? Exporter::GetViewableFormats(owner_->buffer())
|
? Exporter::GetViewableFormats(owner_->buffer())
|
||||||
: Exporter::GetExportableFormats(owner_->buffer());
|
: Exporter::GetExportableFormats(owner_->buffer());
|
||||||
|
|
||||||
for (std::vector<pair<string,string> >::const_iterator cit = names.begin();
|
for (vector<pair<string,string> >::const_iterator cit = names.begin();
|
||||||
cit != names.end() ; ++cit) {
|
cit != names.end() ; ++cit) {
|
||||||
int action2 =
|
int action2 =
|
||||||
lyxaction.getPseudoAction(action, (*cit).first);
|
lyxaction.getPseudoAction(action, (*cit).first);
|
||||||
@ -288,14 +549,14 @@ void Menubar::Pimpl::add_formats(int menu, string const & extra_label,
|
|||||||
if ((cit + 1) == names.end())
|
if ((cit + 1) == names.end())
|
||||||
label += extra_label;
|
label += extra_label;
|
||||||
|
|
||||||
fl_addtopup(menu, strpool.add(label));
|
fl_addtopup(menu, label.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
||||||
string const & menu_name,
|
string const & menu_name,
|
||||||
std::vector<int> & smn, StrPool & strpool)
|
vector<int> & smn)
|
||||||
{
|
{
|
||||||
if (!menubackend_->hasMenu(menu_name)){
|
if (!menubackend_->hasMenu(menu_name)){
|
||||||
lyxerr << "ERROR:create_submenu: Unknown menu `"
|
lyxerr << "ERROR:create_submenu: Unknown menu `"
|
||||||
@ -317,7 +578,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
string widest_label;
|
string widest_label;
|
||||||
Menu::const_iterator end = md.end();
|
Menu::const_iterator end = md.end();
|
||||||
for (Menu::const_iterator i = md.begin(); i != end; ++i) {
|
for (Menu::const_iterator i = md.begin(); i != end; ++i) {
|
||||||
MenuItem item = (*i);
|
MenuItem const & item = (*i);
|
||||||
if (item.kind() == MenuItem::Command) {
|
if (item.kind() == MenuItem::Command) {
|
||||||
string label = item.label() + '\t';
|
string label = item.label() + '\t';
|
||||||
int width = string_width(label);
|
int width = string_width(label);
|
||||||
@ -331,13 +592,21 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
<< ", widest_label=`" << widest_label
|
<< ", widest_label=`" << widest_label
|
||||||
<< "'" << endl;
|
<< "'" << endl;
|
||||||
|
|
||||||
for (Menu::const_iterator i = md.begin(); i != end; ++i) {
|
// Compute where to put separators
|
||||||
MenuItem item = (*i);
|
vector<string> extra_labels(md.size());
|
||||||
// Is there a separator after this item?
|
vector<string>::iterator it = extra_labels.begin();
|
||||||
string extra_label;
|
vector<string>::iterator last = it;
|
||||||
if ((i+1) != end
|
for (Menu::const_iterator i = md.begin(); i != end; ++i, ++it)
|
||||||
&& (i+1)->kind() == MenuItem::Separator)
|
if (i->kind() == MenuItem::Separator)
|
||||||
extra_label = "%l";
|
*last = "%l";
|
||||||
|
else if (!i->optional() ||
|
||||||
|
!(view->getLyXFunc()->getStatus(i->action()) & LyXFunc::Disabled))
|
||||||
|
last = it;
|
||||||
|
|
||||||
|
it = extra_labels.begin();
|
||||||
|
for (Menu::const_iterator i = md.begin(); i != end; ++i, ++it) {
|
||||||
|
MenuItem const & item = (*i);
|
||||||
|
string & extra_label = *it;
|
||||||
|
|
||||||
switch(item.kind()) {
|
switch(item.kind()) {
|
||||||
case MenuItem::Command: {
|
case MenuItem::Command: {
|
||||||
@ -384,10 +653,10 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
if (!shortcut.empty()) {
|
if (!shortcut.empty()) {
|
||||||
shortcut += lowercase(shortcut[0]);
|
shortcut += lowercase(shortcut[0]);
|
||||||
label += "%h";
|
label += "%h";
|
||||||
fl_addtopup(menu, strpool.add(label),
|
fl_addtopup(menu, label.c_str(),
|
||||||
strpool.add(shortcut));
|
shortcut.c_str());
|
||||||
} else
|
} else
|
||||||
fl_addtopup(menu, strpool.add(label));
|
fl_addtopup(menu, label.c_str());
|
||||||
|
|
||||||
lyxerr[Debug::GUI] << "Command: \""
|
lyxerr[Debug::GUI] << "Command: \""
|
||||||
<< lyxaction.getActionName(item.action())
|
<< lyxaction.getActionName(item.action())
|
||||||
@ -401,8 +670,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
|
|
||||||
case MenuItem::Submenu: {
|
case MenuItem::Submenu: {
|
||||||
int submenu = create_submenu(win, view,
|
int submenu = create_submenu(win, view,
|
||||||
item.submenu(),
|
item.submenu(), smn);
|
||||||
smn, strpool);
|
|
||||||
if (submenu == -1)
|
if (submenu == -1)
|
||||||
return -1;
|
return -1;
|
||||||
string label = item.label();
|
string label = item.label();
|
||||||
@ -410,11 +678,11 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
string shortcut = item.shortcut();
|
string shortcut = item.shortcut();
|
||||||
if (!shortcut.empty()) {
|
if (!shortcut.empty()) {
|
||||||
shortcut += lowercase(shortcut[0]);
|
shortcut += lowercase(shortcut[0]);
|
||||||
fl_addtopup(menu, strpool.add(label + "%h"),
|
fl_addtopup(menu, (label + "%h").c_str(),
|
||||||
submenu, strpool.add(shortcut));
|
submenu, shortcut.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fl_addtopup(menu, strpool.add(label), submenu);
|
fl_addtopup(menu, label.c_str(), submenu);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -425,26 +693,31 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuItem::Documents:
|
case MenuItem::Documents:
|
||||||
add_documents(menu, extra_label, smn, strpool);
|
add_documents(menu, extra_label);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuItem::Lastfiles:
|
case MenuItem::Lastfiles:
|
||||||
add_lastfiles(menu, extra_label, smn, strpool);
|
add_lastfiles(menu, extra_label);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MenuItem::Toc:
|
||||||
|
add_toc(menu, extra_label, smn, win);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MenuItem::References:
|
||||||
|
add_references(menu, extra_label, smn, win);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuItem::ViewFormats:
|
case MenuItem::ViewFormats:
|
||||||
add_formats(menu, extra_label, smn, strpool,
|
add_formats(menu, extra_label, LFUN_PREVIEW, true);
|
||||||
LFUN_PREVIEW, true);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuItem::UpdateFormats:
|
case MenuItem::UpdateFormats:
|
||||||
add_formats(menu, extra_label, smn, strpool,
|
add_formats(menu, extra_label, LFUN_UPDATE, true);
|
||||||
LFUN_UPDATE, true);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuItem::ExportFormats:
|
case MenuItem::ExportFormats:
|
||||||
add_formats(menu, extra_label, smn, strpool,
|
add_formats(menu, extra_label, LFUN_EXPORT, false);
|
||||||
LFUN_EXPORT, false);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -482,12 +755,10 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
|
|||||||
|
|
||||||
// set tabstop length
|
// set tabstop length
|
||||||
fl_set_tabstop(menu_tabstop);
|
fl_set_tabstop(menu_tabstop);
|
||||||
std::vector<int> submenus;
|
vector<int> submenus;
|
||||||
StrPool strpool;
|
|
||||||
int menu = iteminfo->pimpl_->
|
int menu = iteminfo->pimpl_->
|
||||||
create_submenu(FL_ObjWin(ob), view,
|
create_submenu(FL_ObjWin(ob), view,
|
||||||
item->submenu(),
|
item->submenu(), submenus);
|
||||||
submenus, strpool);
|
|
||||||
if (menu != -1) {
|
if (menu != -1) {
|
||||||
// place popup
|
// place popup
|
||||||
fl_setpup_position(view->getForm()->x + ob->x,
|
fl_setpup_position(view->getForm()->x + ob->x,
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
class LyXView;
|
class LyXView;
|
||||||
class MenuBackend;
|
class MenuBackend;
|
||||||
class MenuItem;
|
class MenuItem;
|
||||||
class StrPool;
|
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
@ -50,26 +49,28 @@ public:
|
|||||||
/** Add to "menu" the list of last opened files
|
/** Add to "menu" the list of last opened files
|
||||||
(add "extra_label" to the last entry)
|
(add "extra_label" to the last entry)
|
||||||
*/
|
*/
|
||||||
void add_lastfiles(int menu, string const & extra_label,
|
void add_lastfiles(int menu, string const & extra_label);
|
||||||
std::vector<int> & smn, StrPool & strpool);
|
|
||||||
/** Add to "menu" the list of opened documents
|
/** Add to "menu" the list of opened documents
|
||||||
(add "extra_label" to the last entry)
|
(add "extra_label" to the last entry)
|
||||||
*/
|
*/
|
||||||
void add_documents(int menu, string const & extra_label,
|
void add_documents(int menu, string const & extra_label);
|
||||||
std::vector<int> & smn, StrPool & strpool);
|
|
||||||
/// Add to "menu" the list of exportable/viewable formats
|
/// Add to "menu" the list of exportable/viewable formats
|
||||||
/// (add "extra_label" to the last entry)
|
/// (add "extra_label" to the last entry)
|
||||||
void add_formats(int menu, string const & extra_label,
|
void add_formats(int menu, string const & extra_label,
|
||||||
std::vector<int> & smn, StrPool & strpool,
|
|
||||||
kb_action action, bool viewable);
|
kb_action action, bool viewable);
|
||||||
///
|
///
|
||||||
|
void add_toc(int menu, string const & extra_label,
|
||||||
|
std::vector<int> & smn, Window win);
|
||||||
|
///
|
||||||
|
void add_references(int menu, string const & extra_label,
|
||||||
|
std::vector<int> & smn, Window win);
|
||||||
|
///
|
||||||
int create_submenu(Window win, LyXView * view,
|
int create_submenu(Window win, LyXView * view,
|
||||||
string const & menuname,
|
string const & menuname,
|
||||||
std::vector<int> & smn, StrPool & strpool);
|
std::vector<int> & smn);
|
||||||
|
|
||||||
/// update the state of the menuitems
|
/// update the state of the menuitems
|
||||||
void update() {}
|
void update() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
FL_OBJECT * frame_;
|
FL_OBJECT * frame_;
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
#include "FormDocument.h"
|
#include "FormDocument.h"
|
||||||
#include "bmtable.h"
|
#include "bmtable.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
|
#include "xform_macros.h"
|
||||||
|
|
||||||
|
C_GENERICCB(FormDocument, BulletBMTableCB)
|
||||||
|
|
||||||
FD_form_tabbed_document::~FD_form_tabbed_document()
|
FD_form_tabbed_document::~FD_form_tabbed_document()
|
||||||
{
|
{
|
||||||
@ -396,7 +399,7 @@ FD_form_doc_bullet * FormDocument::build_doc_bullet()
|
|||||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 345, "");
|
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 345, "");
|
||||||
fl_set_border_width(-3);
|
fl_set_border_width(-3);
|
||||||
fdui->bmtable_bullet_panel = obj = fl_add_bmtable(1, 90, 105, 265, 180, "");
|
fdui->bmtable_bullet_panel = obj = fl_add_bmtable(1, 90, 105, 265, 180, "");
|
||||||
fl_set_object_callback(obj, BulletBMTableCB, 0);
|
fl_set_object_callback(obj, C_FormDocumentBulletBMTableCB, 0);
|
||||||
fl_set_object_lcol(obj, FL_BLUE);
|
fl_set_object_lcol(obj, FL_BLUE);
|
||||||
fl_set_object_boxtype(obj, FL_UP_BOX);
|
fl_set_object_boxtype(obj, FL_UP_BOX);
|
||||||
fl_set_bmtable_pixmap_file(obj, 6, 6,
|
fl_set_bmtable_pixmap_file(obj, 6, 6,
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
--- form_document.C.orig Mon Aug 14 13:17:32 2000
|
--- form_document.C.orig Mon Aug 14 13:17:32 2000
|
||||||
+++ form_document.C Mon Aug 14 13:22:59 2000
|
+++ form_document.C Mon Aug 14 13:22:59 2000
|
||||||
@@ -9,6 +9,8 @@
|
@@ -9,6 +9,11 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "form_document.h"
|
#include "form_document.h"
|
||||||
#include "FormDocument.h"
|
#include "FormDocument.h"
|
||||||
+#include "bmtable.h"
|
+#include "bmtable.h"
|
||||||
+#include "support/filetools.h"
|
+#include "support/filetools.h"
|
||||||
|
+#include "xform_macros.h"
|
||||||
|
+
|
||||||
|
+C_GENERICCB(FormDocument, BulletBMTableCB)
|
||||||
|
|
||||||
FD_form_tabbed_document::~FD_form_tabbed_document()
|
FD_form_tabbed_document::~FD_form_tabbed_document()
|
||||||
{
|
{
|
||||||
@ -20,7 +23,7 @@
|
|||||||
- fl_set_pixmapbutton_file(obj, _("/nfs/sinco/source/lyx/lyx-devel/lib/images/psnfss2.xpm"));
|
- fl_set_pixmapbutton_file(obj, _("/nfs/sinco/source/lyx/lyx-devel/lib/images/psnfss2.xpm"));
|
||||||
+ fl_set_border_width(-3);
|
+ fl_set_border_width(-3);
|
||||||
+ fdui->bmtable_bullet_panel = obj = fl_add_bmtable(1, 90, 105, 265, 180, "");
|
+ fdui->bmtable_bullet_panel = obj = fl_add_bmtable(1, 90, 105, 265, 180, "");
|
||||||
+ fl_set_object_callback(obj, BulletBMTableCB, 0);
|
+ fl_set_object_callback(obj, C_FormDocumentBulletBMTableCB, 0);
|
||||||
+ fl_set_object_lcol(obj, FL_BLUE);
|
+ fl_set_object_lcol(obj, FL_BLUE);
|
||||||
+ fl_set_object_boxtype(obj, FL_UP_BOX);
|
+ fl_set_object_boxtype(obj, FL_UP_BOX);
|
||||||
+ fl_set_bmtable_pixmap_file(obj, 6, 6,
|
+ fl_set_bmtable_pixmap_file(obj, 6, 6,
|
||||||
|
@ -612,6 +612,9 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
|||||||
case LFUN_VC_HISTORY:
|
case LFUN_VC_HISTORY:
|
||||||
disable = !buf->lyxvc.inUse();
|
disable = !buf->lyxvc.inUse();
|
||||||
break;
|
break;
|
||||||
|
case LFUN_REF_BACK:
|
||||||
|
disable = owner->view()->NoSavedPositions();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1584,15 +1587,11 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
MenuInsertLabel(argument.c_str());
|
MenuInsertLabel(argument.c_str());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_REF_CREATE:
|
case LFUN_REF_INSERT:
|
||||||
{
|
if (argument.empty()) {
|
||||||
InsetCommandParams p("ref");
|
InsetCommandParams p("ref");
|
||||||
owner->getDialogs()->createRef(p.getAsString());
|
owner->getDialogs()->createRef(p.getAsString());
|
||||||
}
|
} else {
|
||||||
break;
|
|
||||||
|
|
||||||
case LFUN_REF_INSERT:
|
|
||||||
{
|
|
||||||
InsetCommandParams p;
|
InsetCommandParams p;
|
||||||
p.setFromString(argument);
|
p.setFromString(argument);
|
||||||
|
|
||||||
@ -2533,6 +2532,28 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_GOTO_PARAGRAPH:
|
||||||
|
{
|
||||||
|
#ifdef HAVE_SSTREAM
|
||||||
|
istringstream istr(argument);
|
||||||
|
#else
|
||||||
|
istrstream istr(argument.c_str());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int id;
|
||||||
|
istr >> id;
|
||||||
|
LyXParagraph * par = owner->view()->text->GetParFromID(id);
|
||||||
|
|
||||||
|
// Set the cursor
|
||||||
|
owner->view()->text->SetCursor(owner->view(), par, 0);
|
||||||
|
owner->view()->setState();
|
||||||
|
owner->showState();
|
||||||
|
|
||||||
|
// Recenter screen
|
||||||
|
owner->view()->center();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case LFUN_APROPOS:
|
case LFUN_APROPOS:
|
||||||
case LFUN_GETTIP:
|
case LFUN_GETTIP:
|
||||||
{
|
{
|
||||||
|
@ -1905,7 +1905,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
|
|||||||
|
|
||||||
case 12: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
|
case 12: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
|
||||||
case 13: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
|
case 13: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
|
||||||
case 14: tmpfunc->Dispatch(LFUN_REF_CREATE); break;
|
case 14: tmpfunc->Dispatch(LFUN_REF_INSERT); break;
|
||||||
case 15: tmpfunc->Dispatch(LFUN_CITATION_CREATE); break;
|
case 15: tmpfunc->Dispatch(LFUN_CITATION_CREATE); break;
|
||||||
case 16: tmpfunc->Dispatch(LFUN_INDEX_CREATE); break;
|
case 16: tmpfunc->Dispatch(LFUN_INDEX_CREATE); break;
|
||||||
case 17: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;
|
case 17: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user