mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
Yes, yet another patch from Herbert!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3484 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
961105ec0e
commit
bcfdd54d46
@ -1,3 +1,10 @@
|
||||
2002-02-04 Herbert Voss <voss@lyx.org>
|
||||
|
||||
* forms/form_graphics.fd: small changes to the layout
|
||||
* FormGraphic.C: Apply-button, keepaspectratio enabling
|
||||
depends to case of LaTeXView. Other small changes and
|
||||
fixes. Add LyXView scale.
|
||||
|
||||
2002-02-01 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* FormGraphics.C (c-tor): prevent resizing of the dialog.
|
||||
|
@ -71,9 +71,10 @@ void FormGraphics::build()
|
||||
|
||||
// Manage the ok, apply, restore 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().setRestore(dialog_->button_help);
|
||||
bc().addReadOnly(dialog_->button_help);
|
||||
|
||||
// the file section
|
||||
file_.reset(build_file());
|
||||
@ -182,8 +183,8 @@ void FormGraphics::apply()
|
||||
igp.rotateOrigin = fl_get_choice_text(file_->choice_origin);
|
||||
else
|
||||
igp.rotateOrigin = string();
|
||||
igp.scale = strToInt(getStringFromInput(size_->input_scale));
|
||||
igp.keepAspectRatio = fl_get_button(size_->check_aspectratio);
|
||||
igp.draft = fl_get_button(file_->button_draft);
|
||||
igp.clip = fl_get_button(file_->button_clip);
|
||||
|
||||
// the lyxview section
|
||||
switch (fl_get_choice(lyxview_->choice_display)) {
|
||||
@ -203,14 +204,19 @@ void FormGraphics::apply()
|
||||
igp.display = InsetGraphicsParams::NONE;
|
||||
break;
|
||||
}
|
||||
if (fl_get_button(lyxview_->button_lyxdefault))
|
||||
igp.lyxsize_type = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
else if (fl_get_button(lyxview_->button_lyxwh))
|
||||
igp.lyxsize_type = InsetGraphicsParams::WH;
|
||||
else
|
||||
igp.lyxsize_type = InsetGraphicsParams::SCALE;
|
||||
igp.lyxwidth = LyXLength(getLengthFromWidgets(lyxview_->input_lyxwidth,
|
||||
lyxview_->choice_width_lyxwidth));
|
||||
igp.lyxheight = LyXLength(getLengthFromWidgets(lyxview_->input_lyxheight,
|
||||
lyxview_->choice_width_lyxheight));
|
||||
igp.lyxscale = strToInt(getStringFromInput(lyxview_->input_lyxscale));
|
||||
|
||||
// the size section
|
||||
igp.draft = fl_get_button(file_->button_draft);
|
||||
igp.clip = fl_get_button(file_->button_clip);
|
||||
if (fl_get_button(size_->button_default))
|
||||
igp.size_type = InsetGraphicsParams::DEFAULT_SIZE;
|
||||
else if (fl_get_button(size_->button_wh))
|
||||
@ -221,6 +227,8 @@ void FormGraphics::apply()
|
||||
size_->choice_width_units));
|
||||
igp.height = LyXLength(getLengthFromWidgets(size_->input_height,
|
||||
size_->choice_height_units));
|
||||
igp.scale = strToInt(getStringFromInput(size_->input_scale));
|
||||
igp.keepAspectRatio = fl_get_button(size_->check_aspectratio);
|
||||
|
||||
// the bb section
|
||||
if (!controller().bbChanged) // different to the original one?
|
||||
@ -300,6 +308,36 @@ void FormGraphics::update() {
|
||||
lyxview_->choice_width_lyxwidth, igp.lyxwidth,defaultUnit);
|
||||
updateWidgetsFromLength(lyxview_->input_lyxheight,
|
||||
lyxview_->choice_width_lyxheight, igp.lyxheight,defaultUnit);
|
||||
fl_set_input(lyxview_->input_lyxscale, tostr(igp.lyxscale).c_str());
|
||||
switch (igp.lyxsize_type) {
|
||||
case InsetGraphicsParams::DEFAULT_SIZE: {
|
||||
fl_set_button(lyxview_->button_lyxdefault,1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
break;
|
||||
}
|
||||
case InsetGraphicsParams::WH: {
|
||||
fl_set_button(lyxview_->button_lyxwh, 1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 1);
|
||||
setEnabled(lyxview_->input_lyxheight, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 1);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
break;
|
||||
}
|
||||
case InsetGraphicsParams::SCALE: {
|
||||
fl_set_button(lyxview_->button_lyxscale, 1);
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// the size section
|
||||
// Update the draft and clip mode
|
||||
@ -315,6 +353,7 @@ void FormGraphics::update() {
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
break;
|
||||
}
|
||||
@ -324,6 +363,7 @@ void FormGraphics::update() {
|
||||
setEnabled(size_->choice_width_units, 1);
|
||||
setEnabled(size_->input_height, 1);
|
||||
setEnabled(size_->choice_height_units, 1);
|
||||
setEnabled(size_->check_aspectratio, 1);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
break;
|
||||
}
|
||||
@ -333,6 +373,7 @@ void FormGraphics::update() {
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 1);
|
||||
break;
|
||||
}
|
||||
@ -392,6 +433,7 @@ bool isValid(FL_OBJECT * ob)
|
||||
|
||||
ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
{
|
||||
// the file section
|
||||
if (ob == file_->button_browse) {
|
||||
// Get the filename from the dialog
|
||||
string const in_name = getStringFromInput(file_->input_filename);
|
||||
@ -399,33 +441,37 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
if (out_name != in_name && !out_name.empty()) {
|
||||
fl_set_input(file_->input_filename, out_name.c_str());
|
||||
}
|
||||
} else if (ob == file_->check_subcaption) {
|
||||
setEnabled(file_->input_subcaption,
|
||||
fl_get_button(file_->check_subcaption));
|
||||
|
||||
// the lyxview section
|
||||
} else if (ob == lyxview_->button_lyxdefault) {
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
} else if (ob == lyxview_->button_lyxwh) {
|
||||
setEnabled(lyxview_->input_lyxwidth, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 1);
|
||||
setEnabled(lyxview_->input_lyxheight, 1);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 1);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
} else if (ob == lyxview_->button_lyxscale) {
|
||||
setEnabled(lyxview_->input_lyxwidth, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxwidth, 0);
|
||||
setEnabled(lyxview_->input_lyxheight, 0);
|
||||
setEnabled(lyxview_->choice_width_lyxheight, 0);
|
||||
setEnabled(lyxview_->input_lyxscale, 1);
|
||||
|
||||
// the bb section
|
||||
} else if (!controller().bbChanged &&
|
||||
((ob == bbox_->input_bb_x0) || (ob == bbox_->input_bb_y0) ||
|
||||
(ob == bbox_->input_bb_x1) || (ob == bbox_->input_bb_y1) ||
|
||||
(ob == bbox_->choice_bb_x0) || (ob == bbox_->choice_bb_y0) ||
|
||||
(ob == bbox_->choice_bb_x1) || (ob == bbox_->choice_bb_y1))) {
|
||||
controller().bbChanged = true;
|
||||
} else if (ob == size_->button_default) {
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
} else if (ob == size_->button_wh) {
|
||||
setEnabled(size_->input_width, 1);
|
||||
setEnabled(size_->choice_width_units, 1);
|
||||
setEnabled(size_->input_height, 1);
|
||||
setEnabled(size_->choice_height_units, 1);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
} else if (ob == size_->button_scale) {
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->input_scale, 1);
|
||||
} else if (ob == file_->check_subcaption) {
|
||||
setEnabled(file_->input_subcaption,
|
||||
fl_get_button(file_->check_subcaption));
|
||||
} else if (ob == bbox_->button_getBB) {
|
||||
string const filename = getStringFromInput(file_->input_filename);
|
||||
if (!filename.empty()) {
|
||||
@ -440,6 +486,29 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
}
|
||||
controller().bbChanged = false;
|
||||
}
|
||||
|
||||
// the size section
|
||||
} else if (ob == size_->button_default) {
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
} else if (ob == size_->button_wh) {
|
||||
setEnabled(size_->input_width, 1);
|
||||
setEnabled(size_->choice_width_units, 1);
|
||||
setEnabled(size_->input_height, 1);
|
||||
setEnabled(size_->choice_height_units, 1);
|
||||
setEnabled(size_->check_aspectratio, 1);
|
||||
setEnabled(size_->input_scale, 0);
|
||||
} else if (ob == size_->button_scale) {
|
||||
setEnabled(size_->input_width, 0);
|
||||
setEnabled(size_->choice_width_units, 0);
|
||||
setEnabled(size_->input_height, 0);
|
||||
setEnabled(size_->choice_height_units, 0);
|
||||
setEnabled(size_->check_aspectratio, 0);
|
||||
setEnabled(size_->input_scale, 1);
|
||||
} else if (ob == dialog_->button_help) {
|
||||
controller().help();
|
||||
}
|
||||
|
@ -31,33 +31,38 @@ FD_form_graphics * FormGraphics::build_graphics()
|
||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||
{
|
||||
char const * const dummy = N_("Help|#H");
|
||||
fdui->button_help = obj = fl_add_button(FL_NORMAL_BUTTON, 15, 320, 90, 30, idex(_(dummy)));
|
||||
fdui->button_help = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 320, 65, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
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, 165, 320, 90, 30, idex(_(dummy)));
|
||||
fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 205, 320, 80, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
|
||||
fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 315, 320, 90, 30, _("Ok"));
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 320, 75, 30, _("Ok"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
|
||||
{
|
||||
char const * const dummy = N_("Cancel|^[");
|
||||
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 410, 320, 90, 30, idex(_(dummy)));
|
||||
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 325, 320, 75, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
|
||||
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 10, 280, 485, 35, "");
|
||||
{
|
||||
char const * const dummy = N_("Apply|#A");
|
||||
fdui->button_apply = obj = fl_add_button(FL_RETURN_BUTTON, 95, 320, 75, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseApplyCB, 0);
|
||||
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 15, 275, 485, 35, "");
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form->fdui = fdui;
|
||||
@ -124,7 +129,7 @@ FD_form_file * FormGraphics::build_file()
|
||||
}
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 175, 130, 66, 30, _("degrees"));
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 180, 130, 66, 30, _("degrees"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
{
|
||||
@ -436,12 +441,20 @@ FD_form_lyxview * FormGraphics::build_lyxview()
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_bgn_group();
|
||||
obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 205, 20, 30, 30, "Default|#D");
|
||||
{
|
||||
char const * const dummy = N_("Default|#D");
|
||||
fdui->button_lyxdefault = obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 205, 20, 30, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_color(obj, FL_COL1, FL_YELLOW);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 205, 70, 30, 30, "Custom|#C");
|
||||
{
|
||||
char const * const dummy = N_("Custom|#C");
|
||||
fdui->button_lyxwh = obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 205, 70, 30, 30, idex(_(dummy)));
|
||||
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
|
||||
}
|
||||
fl_set_object_color(obj, FL_COL1, FL_YELLOW);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
|
||||
|
@ -9,6 +9,7 @@ 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_FormBaseInputCB(FL_OBJECT *, long);
|
||||
|
||||
@ -31,6 +32,7 @@ struct FD_form_graphics {
|
||||
FL_OBJECT *button_restore;
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *button_apply;
|
||||
FL_OBJECT *text_warning;
|
||||
};
|
||||
struct FD_form_file {
|
||||
@ -91,6 +93,8 @@ struct FD_form_lyxview {
|
||||
FL_OBJECT *input_lyxheight;
|
||||
FL_OBJECT *choice_width_lyxheight;
|
||||
FL_OBJECT *input_lyxscale;
|
||||
FL_OBJECT *button_lyxdefault;
|
||||
FL_OBJECT *button_lyxwh;
|
||||
FL_OBJECT *button_lyxscale;
|
||||
};
|
||||
|
||||
|
@ -11,7 +11,7 @@ SnapGrid: 5
|
||||
Name: form_graphics
|
||||
Width: 510
|
||||
Height: 360
|
||||
Number of Objects: 7
|
||||
Number of Objects: 8
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
@ -52,7 +52,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 15 320 90 30
|
||||
box: 435 320 65 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -70,7 +70,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 165 320 90 30
|
||||
box: 205 320 80 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -88,7 +88,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 315 320 90 30
|
||||
box: 10 320 75 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -106,7 +106,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 410 320 90 30
|
||||
box: 325 320 75 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -121,15 +121,33 @@ name: button_cancel
|
||||
callback: C_FormBaseCancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 95 320 75 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Apply|#A
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_apply
|
||||
callback: C_FormBaseApplyCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 10 280 485 35
|
||||
box: 15 275 485 35
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_BOLD_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
@ -292,7 +310,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 175 130 66 30
|
||||
box: 180 130 66 30
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
@ -1119,7 +1137,7 @@ label: Default|#D
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
name: button_lyxdefault
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
@ -1137,7 +1155,7 @@ label: Custom|#C
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
name: button_lyxwh
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2002-02-04 Herbert Voss <voss@lyx.org>
|
||||
|
||||
* insetgraphic.C:
|
||||
* insetgraphicsParams.[Ch]: add a LyXView-scale to have a
|
||||
similiar view to the LaTeX one. Get zipped files work.
|
||||
|
||||
2002-02-04 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* insetgraphicsParams.C (init): set display to DEFAULT.
|
||||
|
@ -126,7 +126,7 @@ using std::ostream;
|
||||
using std::endl;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
int VersionNumber = 1;
|
||||
int const VersionNumber = 1;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This function is a utility function
|
||||
@ -542,8 +542,8 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
|
||||
// we handle it like a virtual one, so we can have
|
||||
// different extensions with the same type.
|
||||
// if it's a zipped one, than let LaTeX do the rest!!!
|
||||
//if (zippedFile(params.filename))
|
||||
// return params.filename;
|
||||
if (zippedFile(params.filename))
|
||||
return params.filename;
|
||||
// now we have unzipped files
|
||||
string const extension = getExtFromContents(params.filename);
|
||||
// Are we creating a PDF or a PS file?
|
||||
|
@ -104,7 +104,9 @@ void InsetGraphicsParams::init()
|
||||
lyxwidth = LyXLength(); // for the view in lyx
|
||||
lyxheight = LyXLength();
|
||||
scale = 0;
|
||||
lyxscale = 0;
|
||||
size_type = DEFAULT_SIZE; // do nothing
|
||||
lyxsize_type = DEFAULT_SIZE; // do nothing
|
||||
keepAspectRatio = false; //
|
||||
rotateOrigin = "center"; //
|
||||
rotateAngle = 0.0; // in degrees
|
||||
@ -125,8 +127,10 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
|
||||
height = igp.height;
|
||||
scale = igp.scale;
|
||||
size_type = igp.size_type;
|
||||
lyxsize_type = igp.lyxsize_type;
|
||||
lyxwidth = igp.lyxwidth;
|
||||
lyxheight = igp.lyxheight;
|
||||
lyxscale = igp.lyxscale;
|
||||
rotateOrigin = igp.rotateOrigin;
|
||||
rotateAngle = igp.rotateAngle;
|
||||
special = igp.special;
|
||||
@ -147,8 +151,10 @@ bool operator==(InsetGraphicsParams const & left,
|
||||
left.height == right.height &&
|
||||
left.scale == right.scale &&
|
||||
left.size_type == right.size_type &&
|
||||
left.lyxsize_type == right.lyxsize_type &&
|
||||
left.lyxwidth == right.lyxwidth &&
|
||||
left.lyxheight == right.lyxheight &&
|
||||
left.lyxscale == right.lyxscale &&
|
||||
left.rotateOrigin == right.rotateOrigin &&
|
||||
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
|
||||
left.special == right.special)
|
||||
@ -205,10 +211,13 @@ void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
|
||||
os << "\trotateOrigin " << rotateOrigin << '\n';
|
||||
if (!special.empty())
|
||||
os << "\tspecial " << special << '\n';
|
||||
os << "\tlyxsize_type " << lyxsize_type << '\n';
|
||||
if (!lyxwidth.zero()) // the lyx-viewsize
|
||||
os << "\tlyxwidth " << lyxwidth.asString() << '\n';
|
||||
if (!lyxheight.zero())
|
||||
os << "\tlyxheight " << lyxheight.asString();
|
||||
if (lyxscale != 0)
|
||||
os << "\tlyxscale " << lyxscale << '\n';
|
||||
}
|
||||
|
||||
|
||||
@ -284,12 +293,24 @@ bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
|
||||
} else if (token == "rotateOrigin") {
|
||||
lex.next();
|
||||
rotateOrigin=lex.getString();
|
||||
} else if (token == "lyxsize_type") {
|
||||
lex.next();
|
||||
switch (lex.getInteger()) {
|
||||
case 0 : lyxsize_type = DEFAULT_SIZE;
|
||||
break;
|
||||
case 1 : lyxsize_type = WH;
|
||||
break;
|
||||
case 2 : lyxsize_type = SCALE;
|
||||
}
|
||||
} else if (token == "lyxwidth") {
|
||||
lex.next();
|
||||
lyxwidth = LyXLength(lex.getString());
|
||||
} else if (token == "lyxheight") {
|
||||
lex.next();
|
||||
lyxheight = LyXLength(lex.getString());
|
||||
} else if (token == "lyxscale") {
|
||||
lex.next();
|
||||
lyxscale = lex.getInteger();
|
||||
} else {
|
||||
// If it's none of the above, its not ours.
|
||||
return false;
|
||||
|
@ -71,6 +71,10 @@ struct InsetGraphicsParams
|
||||
LyXLength lyxwidth;
|
||||
///
|
||||
LyXLength lyxheight;
|
||||
/// Typ of rescaling the Screen
|
||||
int lyxscale;
|
||||
/// Typ of the LyXView, same as for latex
|
||||
sizeType lyxsize_type;
|
||||
/// Origin point of rotation
|
||||
string rotateOrigin;
|
||||
/// Rotation angle.
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-02-04 Herbert Voss <voss@perce.de>
|
||||
|
||||
* filetools.[Ch]: add ifZippedFile() for zipped
|
||||
graphic files
|
||||
|
||||
2002-02-04 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* filetools.C (FileOpenSearch): remove duplicated line, probably
|
||||
|
@ -971,8 +971,12 @@ string const GetExtension(string const & name)
|
||||
// PDF %PDF-...
|
||||
// PNG .PNG...
|
||||
// PS %!PS-Adobe-2.0
|
||||
// XBM static char ...
|
||||
// XBM ... static char ...
|
||||
// XPM /* XPM */
|
||||
//
|
||||
// GZIP \213\037\008\008... http://www.ietf.org/rfc/rfc1952.txt
|
||||
// ZIP PK... http://www.halyava.ru/document/ind_arch.htm
|
||||
// Z \177\037 UNIX compress
|
||||
/// return the "extension" which belongs to the contents
|
||||
string const getExtFromContents(string const & filename) {
|
||||
if (filename.empty() || !IsFileReadable(filename))
|
||||
@ -980,9 +984,13 @@ string const getExtFromContents(string const & filename) {
|
||||
ifstream ifs(filename.c_str());
|
||||
if (!ifs)
|
||||
return string(); // Couldn't open file...
|
||||
string const gzipStamp = "\213\037\008\008"; // gnuzip
|
||||
string const zipStamp = "PK"; // PKZIP
|
||||
string const compressStamp = "\177\037"; // compress
|
||||
int const max_count = 50; // Maximum strings to read to attempt recognition
|
||||
int count = 0; // Counter of attempts.
|
||||
string str;
|
||||
bool zipChecked = false;
|
||||
for (; count < max_count; ++count) {
|
||||
if (ifs.eof()) {
|
||||
lyxerr[Debug::INFO] << "InsetGraphics (classifyFiletype)"
|
||||
@ -990,6 +998,17 @@ string const getExtFromContents(string const & filename) {
|
||||
break;
|
||||
}
|
||||
ifs >> str;
|
||||
if (!zipChecked) {
|
||||
// at first we check for a zipped file, because this information
|
||||
// is saved in the first bytes of the file!
|
||||
if (str.substr(0,4) == gzipStamp)
|
||||
return "gzip";
|
||||
else if (str.substr(0,2) == zipStamp)
|
||||
return "zip";
|
||||
else if (str.substr(0,2) == compressStamp)
|
||||
return "compress";
|
||||
zipChecked = true;
|
||||
}
|
||||
if (contains(str,"EPSF"))
|
||||
return "eps";
|
||||
else if (contains(str,"GIF"))
|
||||
@ -1013,6 +1032,14 @@ string const getExtFromContents(string const & filename) {
|
||||
}
|
||||
|
||||
|
||||
/// check for zipped file
|
||||
bool zippedFile(string const & name) {
|
||||
string const type = getExtFromContents(name);
|
||||
if (contains("gzip zip",type) && !type.empty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Creates a nice compact path for displaying
|
||||
string const
|
||||
MakeDisplayPath (string const & path, unsigned int threshold)
|
||||
@ -1167,3 +1194,4 @@ void removeAutosaveFile(string const & filename)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,9 +133,11 @@ ChangeExtension(string const & oldname, string const & extension);
|
||||
string const GetExtension(string const & name);
|
||||
|
||||
/// Return the type of the file as an extension from contents
|
||||
///
|
||||
string const getExtFromContents(string const & name);
|
||||
|
||||
/// check for zipped file
|
||||
bool zippedFile(string const & name);
|
||||
|
||||
/// Returns true is path is absolute
|
||||
bool AbsolutePath(string const & path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user