mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Choose labels from other documents
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2752 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5fa24cd3b7
commit
1bfe247634
@ -1,3 +1,7 @@
|
|||||||
|
2001-09-07 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
|
* ControlRef.C (getBufferList, getBufferNum): New methods
|
||||||
|
|
||||||
2001-09-12 Angus Leeming <a.leeming@ic.ac.uk>
|
2001-09-12 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* ControlInset.h (disconnectOnApply): new method. Defines the behaviour
|
* ControlInset.h (disconnectOnApply): new method. Defines the behaviour
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
@ -24,8 +25,13 @@
|
|||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
|
#include "bufferlist.h"
|
||||||
|
|
||||||
using SigC::slot;
|
using SigC::slot;
|
||||||
|
using std::vector;
|
||||||
|
using std::find;
|
||||||
|
|
||||||
|
extern BufferList bufferlist;
|
||||||
|
|
||||||
ControlRef::ControlRef(LyXView & lv, Dialogs & d)
|
ControlRef::ControlRef(LyXView & lv, Dialogs & d)
|
||||||
: ControlCommand(lv, d, LFUN_REF_INSERT)
|
: ControlCommand(lv, d, LFUN_REF_INSERT)
|
||||||
@ -35,9 +41,12 @@ ControlRef::ControlRef(LyXView & lv, Dialogs & d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<string> const ControlRef::getLabelList() const
|
vector<string> const ControlRef::getLabelList(string const & name) const
|
||||||
{
|
{
|
||||||
return lv_.buffer()->getLabelList();
|
Buffer * buffer = bufferlist.getBuffer(name);
|
||||||
|
if (!buffer)
|
||||||
|
buffer = lv_.buffer();
|
||||||
|
return buffer->getLabelList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,3 +62,20 @@ void ControlRef::gotoBookmark() const
|
|||||||
lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_GOTO, "0");
|
lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_GOTO, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vector<string> const ControlRef::getBufferList() const
|
||||||
|
{
|
||||||
|
return bufferlist.getFileNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ControlRef::getBufferNum() const
|
||||||
|
{
|
||||||
|
vector<string> buffers = bufferlist.getFileNames();
|
||||||
|
string const name = lv_.buffer()->fileName();
|
||||||
|
vector<string>::const_iterator cit =
|
||||||
|
find(buffers.begin(), buffers.end(), name);
|
||||||
|
if (cit == buffers.end())
|
||||||
|
return 0;
|
||||||
|
return cit - buffers.begin();
|
||||||
|
}
|
||||||
|
@ -29,11 +29,15 @@ public:
|
|||||||
ControlRef(LyXView &, Dialogs &);
|
ControlRef(LyXView &, Dialogs &);
|
||||||
|
|
||||||
///
|
///
|
||||||
std::vector<string> const getLabelList() const;
|
std::vector<string> const getLabelList(string const &) const;
|
||||||
///
|
///
|
||||||
void gotoRef(string const &) const;
|
void gotoRef(string const &) const;
|
||||||
///
|
///
|
||||||
void gotoBookmark() const;
|
void gotoBookmark() const;
|
||||||
|
///
|
||||||
|
std::vector<string> const getBufferList() const;
|
||||||
|
///
|
||||||
|
int getBufferNum() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONTROLREF_H
|
#endif // CONTROLREF_H
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-09-07 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
|
* forms/form_ref.fd: Add buffer button.
|
||||||
|
|
||||||
|
* FormRef.C (update): Handle the buffer button.
|
||||||
|
(input): Ditto
|
||||||
|
|
||||||
2001-09-13 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2001-09-13 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* forms/form_graphics.fd: complete rewrite of the dialog
|
* forms/form_graphics.fd: complete rewrite of the dialog
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "form_ref.h"
|
#include "form_ref.h"
|
||||||
#include "xforms_helpers.h"
|
#include "xforms_helpers.h"
|
||||||
#include "insets/insetref.h"
|
#include "insets/insetref.h"
|
||||||
|
#include "helper_funcs.h" // getStringFromVector
|
||||||
|
#include "support/lstrings.h" // frontStrip, strip
|
||||||
|
|
||||||
using std::find;
|
using std::find;
|
||||||
using std::max;
|
using std::max;
|
||||||
@ -90,7 +92,13 @@ void FormRef::update()
|
|||||||
setEnabled(dialog_->type, true);
|
setEnabled(dialog_->type, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
refs_ = controller().getLabelList();
|
string const choice =
|
||||||
|
" " + getStringFromVector(controller().getBufferList(), " | ") + " ";
|
||||||
|
fl_clear_choice(dialog_->buffer);
|
||||||
|
fl_addto_choice(dialog_->buffer, choice.c_str());
|
||||||
|
fl_set_choice(dialog_->buffer, controller().getBufferNum() + 1);
|
||||||
|
|
||||||
|
refs_ = controller().getLabelList(string());
|
||||||
updateBrowser(refs_);
|
updateBrowser(refs_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,17 +127,19 @@ void FormRef::updateBrowser(vector<string> const & akeys) const
|
|||||||
setEnabled(dialog_->sort, true);
|
setEnabled(dialog_->sort, true);
|
||||||
|
|
||||||
string ref = fl_get_input(dialog_->ref);
|
string ref = fl_get_input(dialog_->ref);
|
||||||
vector<string>::const_iterator cit =
|
vector<string>::const_iterator cit = (ref.empty())
|
||||||
find(keys.begin(), keys.end(), ref);
|
? keys.begin()
|
||||||
|
: find(keys.begin(), keys.end(), ref);
|
||||||
if (cit == keys.end()) {
|
if (cit == keys.end()) {
|
||||||
cit = keys.begin();
|
fl_deselect_browser(dialog_->browser);
|
||||||
fl_set_input(dialog_->ref, cit->c_str());
|
} else {
|
||||||
} else if (ref.empty())
|
if (ref.empty())
|
||||||
fl_set_input(dialog_->ref, cit->c_str());
|
fl_set_input(dialog_->ref, cit->c_str());
|
||||||
|
|
||||||
int const i = static_cast<int>(cit - keys.begin());
|
int const i = static_cast<int>(cit - keys.begin());
|
||||||
fl_set_browser_topline(dialog_->browser, max(i-5, 1));
|
fl_set_browser_topline(dialog_->browser, max(i-5, 1));
|
||||||
fl_select_browser_line(dialog_->browser, i+1);
|
fl_select_browser_line(dialog_->browser, i+1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,10 +195,15 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
|
|||||||
fl_set_object_lcol(dialog_->ref, FL_BLACK);
|
fl_set_object_lcol(dialog_->ref, FL_BLACK);
|
||||||
|
|
||||||
} else if (ob == dialog_->button_update ||
|
} else if (ob == dialog_->button_update ||
|
||||||
ob == dialog_->sort) {
|
ob == dialog_->sort ||
|
||||||
|
ob == dialog_->buffer) {
|
||||||
|
|
||||||
if (ob == dialog_->button_update)
|
if (ob == dialog_->button_update ||
|
||||||
refs_ = controller().getLabelList();
|
ob == dialog_->buffer) {
|
||||||
|
string const name =
|
||||||
|
frontStrip(strip(fl_get_choice_text(dialog_->buffer)));
|
||||||
|
refs_ = controller().getLabelList(name);
|
||||||
|
}
|
||||||
|
|
||||||
fl_freeze_form(form());
|
fl_freeze_form(form());
|
||||||
updateBrowser(refs_);
|
updateBrowser(refs_);
|
||||||
|
@ -31,14 +31,14 @@ FD_form_ref * FormRef::build_ref()
|
|||||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||||
{
|
{
|
||||||
char const * const dummy = N_("Update|#U");
|
char const * const dummy = N_("Update|#U");
|
||||||
fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 40, 260, 90, 30, idex(_(dummy)));
|
fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 260, 90, 30, idex(_(dummy)));
|
||||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
}
|
}
|
||||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
|
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
|
||||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||||
{
|
{
|
||||||
char const * const dummy = N_("Sort|#S");
|
char const * const dummy = N_("Sort|#S");
|
||||||
fdui->sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 170, 260, 30, 30, idex(_(dummy)));
|
fdui->sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 110, 260, 30, 30, idex(_(dummy)));
|
||||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
}
|
}
|
||||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||||
@ -92,6 +92,15 @@ FD_form_ref * FormRef::build_ref()
|
|||||||
}
|
}
|
||||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||||
fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
|
fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
|
||||||
|
{
|
||||||
|
char const * const dummy = N_("Buffer|#B");
|
||||||
|
fdui->buffer = obj = fl_add_choice(FL_NORMAL_CHOICE, 190, 260, 100, 30, idex(_(dummy)));
|
||||||
|
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||||
|
}
|
||||||
|
fl_set_object_boxtype(obj, FL_FRAME_BOX);
|
||||||
|
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||||
|
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||||
|
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||||
fl_end_form();
|
fl_end_form();
|
||||||
|
|
||||||
fdui->form->fdui = fdui;
|
fdui->form->fdui = fdui;
|
||||||
|
@ -28,6 +28,7 @@ struct FD_form_ref {
|
|||||||
FL_OBJECT *button_cancel;
|
FL_OBJECT *button_cancel;
|
||||||
FL_OBJECT *button_apply;
|
FL_OBJECT *button_apply;
|
||||||
FL_OBJECT *button_restore;
|
FL_OBJECT *button_restore;
|
||||||
|
FL_OBJECT *buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FD_form_ref_h_ */
|
#endif /* FD_form_ref_h_ */
|
||||||
|
@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL
|
|||||||
Name: form_ref
|
Name: form_ref
|
||||||
Width: 530
|
Width: 530
|
||||||
Height: 340
|
Height: 340
|
||||||
Number of Objects: 12
|
Number of Objects: 13
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
@ -46,12 +46,12 @@ resize: FL_RESIZE_ALL
|
|||||||
gravity: FL_NorthWest FL_South
|
gravity: FL_NorthWest FL_South
|
||||||
name: browser
|
name: browser
|
||||||
callback: C_FormBaseInputCB
|
callback: C_FormBaseInputCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
type: NORMAL_BUTTON
|
type: NORMAL_BUTTON
|
||||||
box: 40 260 90 30
|
box: 10 260 90 30
|
||||||
boxtype: FL_UP_BOX
|
boxtype: FL_UP_BOX
|
||||||
colors: FL_COL1 FL_COL1
|
colors: FL_COL1 FL_COL1
|
||||||
alignment: FL_ALIGN_CENTER
|
alignment: FL_ALIGN_CENTER
|
||||||
@ -64,12 +64,12 @@ resize: FL_RESIZE_NONE
|
|||||||
gravity: FL_SouthWest FL_SouthWest
|
gravity: FL_SouthWest FL_SouthWest
|
||||||
name: button_update
|
name: button_update
|
||||||
callback: C_FormBaseInputCB
|
callback: C_FormBaseInputCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_CHECKBUTTON
|
class: FL_CHECKBUTTON
|
||||||
type: PUSH_BUTTON
|
type: PUSH_BUTTON
|
||||||
box: 170 260 30 30
|
box: 110 260 30 30
|
||||||
boxtype: FL_NO_BOX
|
boxtype: FL_NO_BOX
|
||||||
colors: FL_COL1 FL_YELLOW
|
colors: FL_COL1 FL_YELLOW
|
||||||
alignment: FL_ALIGN_RIGHT
|
alignment: FL_ALIGN_RIGHT
|
||||||
@ -82,7 +82,7 @@ resize: FL_RESIZE_NONE
|
|||||||
gravity: FL_SouthWest FL_SouthWest
|
gravity: FL_SouthWest FL_SouthWest
|
||||||
name: sort
|
name: sort
|
||||||
callback: C_FormBaseInputCB
|
callback: C_FormBaseInputCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_INPUT
|
class: FL_INPUT
|
||||||
@ -136,7 +136,7 @@ resize: FL_RESIZE_NONE
|
|||||||
gravity: FL_SouthEast FL_SouthEast
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
name: type
|
name: type
|
||||||
callback: C_FormBaseInputCB
|
callback: C_FormBaseInputCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
@ -154,7 +154,7 @@ resize: FL_RESIZE_NONE
|
|||||||
gravity: FL_SouthEast FL_SouthEast
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
name: button_go
|
name: button_go
|
||||||
callback: C_FormBaseInputCB
|
callback: C_FormBaseInputCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
@ -172,7 +172,7 @@ resize: FL_RESIZE_NONE
|
|||||||
gravity: FL_SouthEast FL_SouthEast
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
name: button_ok
|
name: button_ok
|
||||||
callback: C_FormBaseOKCB
|
callback: C_FormBaseOKCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
@ -190,7 +190,7 @@ resize: FL_RESIZE_NONE
|
|||||||
gravity: FL_SouthEast FL_SouthEast
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
name: button_cancel
|
name: button_cancel
|
||||||
callback: C_FormBaseCancelCB
|
callback: C_FormBaseCancelCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
@ -208,7 +208,7 @@ resize: FL_RESIZE_NONE
|
|||||||
gravity: FL_SouthEast FL_SouthEast
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
name: button_apply
|
name: button_apply
|
||||||
callback: C_FormBaseApplyCB
|
callback: C_FormBaseApplyCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BUTTON
|
class: FL_BUTTON
|
||||||
@ -226,7 +226,25 @@ resize: FL_RESIZE_NONE
|
|||||||
gravity: FL_SouthEast FL_SouthEast
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
name: button_restore
|
name: button_restore
|
||||||
callback: C_FormBaseRestoreCB
|
callback: C_FormBaseRestoreCB
|
||||||
argument:
|
argument: 0
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_CHOICE
|
||||||
|
type: NORMAL_CHOICE
|
||||||
|
box: 190 260 100 30
|
||||||
|
boxtype: FL_FRAME_BOX
|
||||||
|
colors: FL_COL1 FL_BLACK
|
||||||
|
alignment: FL_ALIGN_RIGHT
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_DEFAULT_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: Buffer|#B
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_SouthEast FL_SouthEast
|
||||||
|
name: buffer
|
||||||
|
callback: C_FormBaseInputCB
|
||||||
|
argument: 0
|
||||||
|
|
||||||
==============================
|
==============================
|
||||||
create_the_forms
|
create_the_forms
|
||||||
|
Loading…
Reference in New Issue
Block a user