mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
* New xforms helper functions getVectorFromChoice, getVectorFromBrowser
* Used in the citation and reference dialogs to only update the choices and browsers when absolutely necessary. * Renamed the widgets in the reference dialog in standard style. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2797 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1129104282
commit
d0fb0834e3
@ -1,6 +1,6 @@
|
||||
2001-09-21 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* ControlReferences.h (disconnectOnApply): new method. Set to true.
|
||||
* ControlRef.h (disconnectOnApply): new method. Set to true.
|
||||
Perhaps make this user-modifiable?
|
||||
|
||||
2001-09-14 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
@ -1,3 +1,16 @@
|
||||
2001-09-24 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* FormRef.C:
|
||||
* forms/form_ref.fd: renamed the widgets in the standard style.
|
||||
|
||||
* xforms_helpers.[Ch] (getVectorFromChoice, getVectorFromBrowser): new
|
||||
helper functions. Build a vector<string> from the contents of
|
||||
an fl_choice and fl_browser respectively.
|
||||
|
||||
* FormCitation.C (fillChoice, updateBrowser):
|
||||
* FormRef.C: use these new functions to only update the choices and
|
||||
browsers when absolutely necessary.
|
||||
|
||||
2001-09-24 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* FormBase.C (InputCB):
|
||||
|
@ -48,6 +48,15 @@ int string_width(string const & str)
|
||||
|
||||
void fillChoice(FD_form_citation * dialog, vector<string> vec)
|
||||
{
|
||||
// Check whether the current contents of the browser will be
|
||||
// changed by loading the contents of the vec...
|
||||
vector<string> const choice_style =
|
||||
getVectorFromChoice(dialog->choice_style);
|
||||
|
||||
if (vec == choice_style)
|
||||
return;
|
||||
|
||||
// They will be changed. Proceed
|
||||
string const str = " " + getStringFromVector(vec, " | ") + " ";
|
||||
|
||||
fl_clear_choice(dialog->choice_style);
|
||||
@ -413,6 +422,14 @@ void FormCitation::update()
|
||||
void FormCitation::updateBrowser(FL_OBJECT * browser,
|
||||
vector<string> const & keys) const
|
||||
{
|
||||
// Check whether the current contents of the browser will be
|
||||
// changed by loading the contents of the vec...
|
||||
vector<string> browser_keys = getVectorFromBrowser(browser);
|
||||
|
||||
if (browser_keys == keys)
|
||||
return;
|
||||
|
||||
// They will be changed. Proceed.
|
||||
fl_clear_browser(browser);
|
||||
|
||||
for (vector<string>::const_iterator it = keys.begin();
|
||||
|
@ -44,32 +44,32 @@ void FormRef::build()
|
||||
{
|
||||
dialog_.reset(build_ref());
|
||||
|
||||
for (int i = 0; !InsetRef::types[i].latex_name.empty(); ++i)
|
||||
fl_addto_choice(dialog_->type,
|
||||
for (int i = 0; !InsetRef::types[i].latex_name.empty(); ++i)
|
||||
fl_addto_choice(dialog_->choice_type,
|
||||
_(InsetRef::types[i].gui_name.c_str()));
|
||||
|
||||
// Force the user to use the browser to change refs.
|
||||
fl_deactivate_object(dialog_->ref);
|
||||
fl_deactivate_object(dialog_->input_ref);
|
||||
|
||||
// Manage the ok and cancel/close buttons
|
||||
// Manage the ok and cancel/close buttons
|
||||
bc().setOK(dialog_->button_ok);
|
||||
bc().setApply(dialog_->button_apply);
|
||||
bc().setCancel(dialog_->button_cancel);
|
||||
bc().setRestore(dialog_->button_restore);
|
||||
|
||||
bc().addReadOnly(dialog_->button_update);
|
||||
bc().addReadOnly(dialog_->name);
|
||||
bc().addReadOnly(dialog_->ref);
|
||||
bc().addReadOnly(dialog_->input_name);
|
||||
bc().addReadOnly(dialog_->input_ref);
|
||||
}
|
||||
|
||||
|
||||
void FormRef::update()
|
||||
{
|
||||
fl_set_input(dialog_->ref,
|
||||
fl_set_input(dialog_->input_ref,
|
||||
controller().params().getContents().c_str());
|
||||
fl_set_input(dialog_->name,
|
||||
fl_set_input(dialog_->input_name,
|
||||
controller().params().getOptions().c_str());
|
||||
fl_set_choice(dialog_->type,
|
||||
fl_set_choice(dialog_->choice_type,
|
||||
InsetRef::getType(controller().params().getCmdName()) + 1);
|
||||
|
||||
at_ref_ = false;
|
||||
@ -78,25 +78,38 @@ void FormRef::update()
|
||||
// Name is irrelevant to LaTeX/Literate documents
|
||||
if (controller().docType() == ControlRef::LATEX ||
|
||||
controller().docType() == ControlRef::LITERATE) {
|
||||
setEnabled(dialog_->name, false);
|
||||
setEnabled(dialog_->input_name, false);
|
||||
} else {
|
||||
setEnabled(dialog_->name, true);
|
||||
setEnabled(dialog_->input_name, true);
|
||||
}
|
||||
|
||||
// type is irrelevant to LinuxDoc/DocBook.
|
||||
if (controller().docType() == ControlRef::LINUXDOC ||
|
||||
controller().docType() == ControlRef::DOCBOOK) {
|
||||
fl_set_choice(dialog_->type, 1);
|
||||
setEnabled(dialog_->type, false);
|
||||
fl_set_choice(dialog_->choice_type, 1);
|
||||
setEnabled(dialog_->choice_type, false);
|
||||
} else {
|
||||
setEnabled(dialog_->type, true);
|
||||
setEnabled(dialog_->choice_type, true);
|
||||
}
|
||||
|
||||
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);
|
||||
// Get the available buffers
|
||||
vector<string> const buffers = controller().getBufferList();
|
||||
vector<string> const choice_buffers =
|
||||
getVectorFromChoice(dialog_->choice_buffer);
|
||||
|
||||
// If different from the current contents of the choice, then update it
|
||||
if (buffers != choice_buffers) {
|
||||
// create a string of entries " entry1 | entry2 | entry3 "
|
||||
// with which to initialise the xforms choice object.
|
||||
string const choice =
|
||||
" " + getStringFromVector(buffers, " | ") + " ";
|
||||
|
||||
fl_clear_choice(dialog_->choice_buffer);
|
||||
fl_addto_choice(dialog_->choice_buffer, choice.c_str());
|
||||
|
||||
fl_set_choice(dialog_->choice_buffer,
|
||||
controller().getBufferNum() + 1);
|
||||
}
|
||||
|
||||
refs_ = controller().getLabelList(string());
|
||||
updateBrowser(refs_);
|
||||
@ -106,39 +119,45 @@ void FormRef::update()
|
||||
void FormRef::updateBrowser(vector<string> const & akeys) const
|
||||
{
|
||||
vector<string> keys(akeys);
|
||||
if (fl_get_button(dialog_->sort))
|
||||
if (fl_get_button(dialog_->check_sort))
|
||||
sort(keys.begin(), keys.end());
|
||||
|
||||
fl_clear_browser(dialog_->browser);
|
||||
vector<string> browser_keys =
|
||||
getVectorFromBrowser(dialog_->browser_refs);
|
||||
|
||||
if (browser_keys == keys)
|
||||
return;
|
||||
|
||||
fl_clear_browser(dialog_->browser_refs);
|
||||
for (vector<string>::const_iterator it = keys.begin();
|
||||
it != keys.end(); ++it)
|
||||
fl_add_browser_line(dialog_->browser, it->c_str());
|
||||
fl_add_browser_line(dialog_->browser_refs, it->c_str());
|
||||
|
||||
if (keys.empty()) {
|
||||
fl_add_browser_line(dialog_->browser,
|
||||
fl_add_browser_line(dialog_->browser_refs,
|
||||
_("*** No labels found in document ***"));
|
||||
|
||||
setEnabled(dialog_->browser, false);
|
||||
setEnabled(dialog_->sort, false);
|
||||
setEnabled(dialog_->browser_refs, false);
|
||||
setEnabled(dialog_->check_sort, false);
|
||||
|
||||
fl_set_input(dialog_->ref, "");
|
||||
fl_set_input(dialog_->input_ref, "");
|
||||
} else {
|
||||
setEnabled(dialog_->browser, true);
|
||||
setEnabled(dialog_->sort, true);
|
||||
setEnabled(dialog_->browser_refs, true);
|
||||
setEnabled(dialog_->check_sort, true);
|
||||
|
||||
string ref = fl_get_input(dialog_->ref);
|
||||
string ref = fl_get_input(dialog_->input_ref);
|
||||
vector<string>::const_iterator cit = (ref.empty())
|
||||
? keys.begin()
|
||||
: find(keys.begin(), keys.end(), ref);
|
||||
if (cit == keys.end()) {
|
||||
fl_deselect_browser(dialog_->browser);
|
||||
fl_deselect_browser(dialog_->browser_refs);
|
||||
} else {
|
||||
if (ref.empty())
|
||||
fl_set_input(dialog_->ref, cit->c_str());
|
||||
fl_set_input(dialog_->input_ref, cit->c_str());
|
||||
|
||||
int const i = static_cast<int>(cit - keys.begin());
|
||||
fl_set_browser_topline(dialog_->browser, max(i-5, 1));
|
||||
fl_select_browser_line(dialog_->browser, i+1);
|
||||
fl_set_browser_topline(dialog_->browser_refs, max(i-5, 1));
|
||||
fl_select_browser_line(dialog_->browser_refs, i+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,11 +165,11 @@ void FormRef::updateBrowser(vector<string> const & akeys) const
|
||||
|
||||
void FormRef::apply()
|
||||
{
|
||||
int const type = fl_get_choice(dialog_->type) - 1;
|
||||
int const type = fl_get_choice(dialog_->choice_type) - 1;
|
||||
controller().params().setCmdName(InsetRef::getName(type));
|
||||
|
||||
controller().params().setOptions(fl_get_input(dialog_->name));
|
||||
controller().params().setContents(fl_get_input(dialog_->ref));
|
||||
controller().params().setOptions(fl_get_input(dialog_->input_name));
|
||||
controller().params().setContents(fl_get_input(dialog_->input_ref));
|
||||
}
|
||||
|
||||
|
||||
@ -166,7 +185,7 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
|
||||
|
||||
at_ref_ = !at_ref_;
|
||||
if (at_ref_) {
|
||||
controller().gotoRef(fl_get_input(dialog_->ref));
|
||||
controller().gotoRef(fl_get_input(dialog_->input_ref));
|
||||
fl_set_object_label(dialog_->button_go, _("Go back"));
|
||||
} else {
|
||||
controller().gotoBookmark();
|
||||
@ -174,15 +193,15 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
|
||||
_("Go to reference"));
|
||||
}
|
||||
|
||||
} else if (ob == dialog_->browser) {
|
||||
} else if (ob == dialog_->browser_refs) {
|
||||
|
||||
unsigned int sel = fl_get_browser(dialog_->browser);
|
||||
unsigned int sel = fl_get_browser(dialog_->browser_refs);
|
||||
if (sel < 1 || sel > refs_.size())
|
||||
return ButtonPolicy::SMI_NOOP;
|
||||
|
||||
if (!controller().isReadonly()) {
|
||||
string s = fl_get_browser_line(dialog_->browser, sel);
|
||||
fl_set_input(dialog_->ref, s.c_str());
|
||||
string s = fl_get_browser_line(dialog_->browser_refs, sel);
|
||||
fl_set_input(dialog_->input_ref, s.c_str());
|
||||
}
|
||||
|
||||
if (at_ref_)
|
||||
@ -190,18 +209,18 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
|
||||
at_ref_ = false;
|
||||
fl_set_object_label(dialog_->button_go, _("Go to reference"));
|
||||
|
||||
setEnabled(dialog_->type, true);
|
||||
setEnabled(dialog_->choice_type, true);
|
||||
setEnabled(dialog_->button_go, true);
|
||||
fl_set_object_lcol(dialog_->ref, FL_BLACK);
|
||||
fl_set_object_lcol(dialog_->input_ref, FL_BLACK);
|
||||
|
||||
} else if (ob == dialog_->button_update ||
|
||||
ob == dialog_->sort ||
|
||||
ob == dialog_->buffer) {
|
||||
ob == dialog_->check_sort ||
|
||||
ob == dialog_->choice_buffer) {
|
||||
|
||||
if (ob == dialog_->button_update ||
|
||||
ob == dialog_->buffer) {
|
||||
ob == dialog_->choice_buffer) {
|
||||
string const name =
|
||||
frontStrip(strip(fl_get_choice_text(dialog_->buffer)));
|
||||
frontStrip(strip(fl_get_choice_text(dialog_->choice_buffer)));
|
||||
refs_ = controller().getLabelList(name);
|
||||
}
|
||||
|
||||
@ -209,9 +228,9 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
|
||||
updateBrowser(refs_);
|
||||
fl_unfreeze_form(form());
|
||||
|
||||
} else if (ob == dialog_->type) {
|
||||
} else if (ob == dialog_->choice_type) {
|
||||
|
||||
int const type = fl_get_choice(dialog_->type) - 1;
|
||||
int const type = fl_get_choice(dialog_->choice_type) - 1;
|
||||
if (controller().params().getCmdName() ==
|
||||
InsetRef::getName(type)) {
|
||||
activate = ButtonPolicy::SMI_NOOP;
|
||||
|
@ -25,7 +25,15 @@ FD_form_ref * FormRef::build_ref()
|
||||
fdui->form = fl_bgn_form(FL_NO_BOX, 530, 380);
|
||||
fdui->form->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 530, 380, "");
|
||||
fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 50, 270, 240, "");
|
||||
{
|
||||
char const * const dummy = N_("Buffer|#B");
|
||||
fdui->choice_buffer = obj = fl_add_choice(FL_NORMAL_CHOICE, 105, 10, 350, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_boxtype(obj, FL_FRAME_BOX);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->browser_refs = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 50, 270, 240, "");
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_gravity(obj, FL_NorthWest, FL_South);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
@ -38,7 +46,7 @@ FD_form_ref * FormRef::build_ref()
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Sort|#S");
|
||||
fdui->sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 110, 300, 30, 30, idex(_(dummy)));
|
||||
fdui->check_sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 110, 300, 30, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
@ -46,15 +54,15 @@ FD_form_ref * FormRef::build_ref()
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Name:|#N");
|
||||
fdui->name = obj = fl_add_input(FL_NORMAL_INPUT, 370, 50, 150, 40, idex(_(dummy)));
|
||||
fdui->input_name = obj = fl_add_input(FL_NORMAL_INPUT, 370, 50, 150, 40, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||
fdui->ref = obj = fl_add_input(FL_NORMAL_INPUT, 370, 100, 150, 40, _("Ref:"));
|
||||
fdui->input_ref = obj = fl_add_input(FL_NORMAL_INPUT, 370, 100, 150, 40, _("Ref:"));
|
||||
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
|
||||
{
|
||||
char const * const dummy = N_("Reference type|#R");
|
||||
fdui->type = obj = fl_add_choice(FL_NORMAL_CHOICE, 370, 170, 150, 40, idex(_(dummy)));
|
||||
fdui->choice_type = obj = fl_add_choice(FL_NORMAL_CHOICE, 370, 170, 150, 40, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_boxtype(obj, FL_FRAME_BOX);
|
||||
@ -68,6 +76,13 @@ FD_form_ref * FormRef::build_ref()
|
||||
}
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Restore|#R");
|
||||
fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 340, 90, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 230, 340, 90, 30, _("OK"));
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
|
||||
@ -85,21 +100,6 @@ FD_form_ref * FormRef::build_ref()
|
||||
}
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseApplyCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Restore|#R");
|
||||
fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 340, 90, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Buffer|#B");
|
||||
fdui->buffer = obj = fl_add_choice(FL_NORMAL_CHOICE, 105, 10, 350, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_boxtype(obj, FL_FRAME_BOX);
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form->fdui = fdui;
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
@ -17,18 +17,18 @@ struct FD_form_ref {
|
||||
~FD_form_ref();
|
||||
|
||||
FL_FORM *form;
|
||||
FL_OBJECT *browser;
|
||||
FL_OBJECT *choice_buffer;
|
||||
FL_OBJECT *browser_refs;
|
||||
FL_OBJECT *button_update;
|
||||
FL_OBJECT *sort;
|
||||
FL_OBJECT *name;
|
||||
FL_OBJECT *ref;
|
||||
FL_OBJECT *type;
|
||||
FL_OBJECT *check_sort;
|
||||
FL_OBJECT *input_name;
|
||||
FL_OBJECT *input_ref;
|
||||
FL_OBJECT *choice_type;
|
||||
FL_OBJECT *button_go;
|
||||
FL_OBJECT *button_restore;
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *button_apply;
|
||||
FL_OBJECT *button_restore;
|
||||
FL_OBJECT *buffer;
|
||||
};
|
||||
|
||||
#endif /* FD_form_ref_h_ */
|
||||
|
@ -30,6 +30,24 @@ name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 105 10 350 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
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: choice_buffer
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: HOLD_BROWSER
|
||||
@ -44,7 +62,7 @@ label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_South
|
||||
name: browser
|
||||
name: browser_refs
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
@ -80,7 +98,7 @@ label: Sort|#S
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthWest FL_SouthWest
|
||||
name: sort
|
||||
name: check_sort
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
@ -98,7 +116,7 @@ label: Name:|#N
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthEast FL_NorthEast
|
||||
name: name
|
||||
name: input_name
|
||||
callback:
|
||||
argument:
|
||||
|
||||
@ -116,7 +134,7 @@ label: Ref:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthEast FL_NorthEast
|
||||
name: ref
|
||||
name: input_ref
|
||||
callback:
|
||||
argument:
|
||||
|
||||
@ -134,7 +152,7 @@ label: Reference type|#R
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: type
|
||||
name: choice_type
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
@ -156,6 +174,24 @@ name: button_go
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 10 340 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Restore|#R
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_restore
|
||||
callback: C_FormBaseRestoreCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
@ -210,41 +246,5 @@ name: button_apply
|
||||
callback: C_FormBaseApplyCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 10 340 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Restore|#R
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_restore
|
||||
callback: C_FormBaseRestoreCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 105 10 350 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
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
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "lyxlex.h"
|
||||
#include "support/FileInfo.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h" // frontStrip, strip
|
||||
#include "gettext.h"
|
||||
|
||||
using std::ofstream;
|
||||
@ -35,6 +36,38 @@ void setEnabled(FL_OBJECT * ob, bool enable)
|
||||
}
|
||||
|
||||
|
||||
// Given an fl_choice, create a vector of its entries
|
||||
vector<string> const getVectorFromChoice(FL_OBJECT * ob)
|
||||
{
|
||||
vector<string> vec;
|
||||
if (!ob || ob->objclass != FL_CHOICE)
|
||||
return vec;
|
||||
|
||||
for(int i = 0; i < fl_get_choice_maxitems(ob); ++i) {
|
||||
string const text = fl_get_choice_item_text(ob, i+1);
|
||||
vec.push_back(strip(frontStrip(text)));
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
||||
// Given an fl_browser, create a vector of its entries
|
||||
vector<string> const getVectorFromBrowser(FL_OBJECT * ob)
|
||||
{
|
||||
vector<string> vec;
|
||||
if (!ob || ob->objclass != FL_BROWSER)
|
||||
return vec;
|
||||
|
||||
for(int i = 0; i < fl_get_browser_maxline(ob); ++i) {
|
||||
string const text = fl_get_browser_line(ob, i+1);
|
||||
vec.push_back(strip(frontStrip(text)));
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
||||
// Take a string and add breaks so that it fits into a desired label width, w
|
||||
string formatted(string const & sin, int w, int size, int style)
|
||||
{
|
||||
@ -43,7 +76,7 @@ string formatted(string const & sin, int w, int size, int style)
|
||||
string sout;
|
||||
if (sin.empty()) return sout;
|
||||
|
||||
// break sin up into a vector of individual words
|
||||
// breaks in up into a vector of individual words
|
||||
vector<string> sentence;
|
||||
string word;
|
||||
for (string::const_iterator sit = sin.begin();
|
||||
|
@ -9,13 +9,19 @@
|
||||
|
||||
#include "Color.h"
|
||||
|
||||
// Set an FL_OBJECT to activated or deactivated
|
||||
/// Set an FL_OBJECT to activated or deactivated
|
||||
void setEnabled(FL_OBJECT *, bool enable);
|
||||
|
||||
// Take a string and add breaks so that it fits into a desired label width, w
|
||||
/// Take a string and add breaks so that it fits into a desired label width, w
|
||||
string formatted(string const &label, int w,
|
||||
int=FL_NORMAL_SIZE, int=FL_NORMAL_STYLE);
|
||||
|
||||
/// Given an fl_choice, create a vector of its entries
|
||||
std::vector<string> const getVectorFromChoice(FL_OBJECT *);
|
||||
|
||||
/// Given an fl_browser, create a vector of its entries
|
||||
std::vector<string> const getVectorFromBrowser(FL_OBJECT *);
|
||||
|
||||
/// struct holding xform-specific colors
|
||||
struct XformsColor : public NamedColor {
|
||||
int colorID;
|
||||
|
Loading…
Reference in New Issue
Block a user