From 7e4c025484a47f5a87f42f6aec2b39ee38258d7f Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 5 Dec 2003 02:49:46 +0000 Subject: [PATCH] The External dialog for xforms. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8198 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 6 + src/frontends/xforms/FormExternal.C | 777 ++++++++++++++---- src/frontends/xforms/FormExternal.h | 37 +- src/frontends/xforms/forms/form_external.fd | 840 +++++++++++++++----- 4 files changed, 1301 insertions(+), 359 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 0ced2c897b..235f2c906c 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,9 @@ +2003-12-05 Angus Leeming + + * FormExternal.[Ch]: + * forms/form_external.fd: a total overhaul. In addition, the + dialog can now manipulate the transform data (rotate, scale, crop). + 2003-12-05 Angus Leeming * FormVSpace.C (apply): remove unnecessary test on form(). diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index 77513de129..38ba7b2b7f 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -13,27 +13,306 @@ #include #include "FormExternal.h" -#include "ControlExternal.h" #include "forms/form_external.h" +#include "checkedwidgets.h" #include "input_validators.h" #include "Tooltips.h" #include "xforms_helpers.h" #include "xformsBC.h" +#include "controllers/ControlExternal.h" + +#include "lengthcommon.h" +#include "lyxrc.h" + #include "insets/ExternalTemplate.h" #include "insets/insetexternal.h" #include "support/lstrings.h" +#include "support/lyxlib.h" #include "support/tostr.h" #include "lyx_forms.h" +namespace external = lyx::external; + +using lyx::support::bformat; +using lyx::support::float_equal; using lyx::support::getStringFromVector; +using lyx::support::isStrDbl; +using lyx::support::strToDbl; using lyx::support::strToInt; +using lyx::support::token; using lyx::support::trim; using std::string; +using std::vector; + + +namespace { + +LyXLength::UNIT defaultUnit() +{ + LyXLength::UNIT default_unit = LyXLength::CM; + switch (lyxrc.default_papersize) { + case PAPER_USLETTER: + case PAPER_LEGALPAPER: + case PAPER_EXECUTIVEPAPER: + default_unit = LyXLength::IN; + break; + default: + break; + } + return default_unit; +} + + +void setDisplay(FL_OBJECT * displayCB, FL_OBJECT * showCO, FL_OBJECT * scaleED, + external::DisplayType display, unsigned int scale, + bool read_only) +{ + BOOST_ASSERT(displayCB && displayCB->objclass == FL_CHECKBUTTON); + BOOST_ASSERT(showCO && showCO->objclass == FL_CHOICE); + BOOST_ASSERT(scaleED && scaleED->objclass == FL_INPUT); + + int item = 1; + switch (display) { + case external::DefaultDisplay: + item = 1; + break; + case external::MonochromeDisplay: + item = 2; + break; + case external::GrayscaleDisplay: + item = 3; + break; + case external::ColorDisplay: + item = 4; + break; + case external::PreviewDisplay: + item = 5; + break; + case external::NoDisplay: + item = 1; + break; + } + + fl_set_choice(showCO, item); + + bool const no_display = display == lyx::external::NoDisplay; + setEnabled(showCO, !no_display && !read_only); + + fl_set_button(displayCB, !no_display); + + fl_set_input(scaleED, tostr(scale).c_str()); + setEnabled(scaleED, !no_display && !read_only); +} + + +void getDisplay(external::DisplayType & display, + unsigned int & scale, + FL_OBJECT * displayCB, + FL_OBJECT * showCO, + FL_OBJECT * scaleED) +{ + BOOST_ASSERT(displayCB && displayCB->objclass == FL_CHECKBUTTON); + BOOST_ASSERT(showCO && showCO->objclass == FL_CHOICE); + BOOST_ASSERT(scaleED && scaleED->objclass == FL_INPUT); + + switch (fl_get_choice(showCO)) { + case 1: + display = external::DefaultDisplay; + break; + case 2: + display = external::MonochromeDisplay; + break; + case 3: + display = external::GrayscaleDisplay; + break; + case 4: + display = external::ColorDisplay; + break; + case 5: + display = external::PreviewDisplay; + break; + } + + if (!fl_get_button(displayCB)) + display = external::NoDisplay; + + scale = strToInt(getString(scaleED)); +} + + +void setRotation(FL_OBJECT * angleED, FL_OBJECT * originCO, + external::RotationData const & data) +{ + BOOST_ASSERT(angleED && angleED->objclass == FL_INPUT); + BOOST_ASSERT(originCO && originCO->objclass == FL_CHOICE); + + fl_set_choice(originCO, 1 + int(data.origin())); + fl_set_input(angleED, tostr(data.angle()).c_str()); +} + + +void getRotation(external::RotationData & data, + FL_OBJECT * angleED, FL_OBJECT * originCO) +{ + BOOST_ASSERT(angleED && angleED->objclass == FL_INPUT); + BOOST_ASSERT(originCO && originCO->objclass == FL_CHOICE); + + typedef external::RotationData::OriginType OriginType; + + data.origin(static_cast(fl_get_choice(originCO) - 1)); + data.angle(strToDbl(getString(angleED))); +} + + +void setSize(FL_OBJECT * widthED, FL_OBJECT * widthUnitCO, + FL_OBJECT * heightED, FL_OBJECT * heightUnitCO, + FL_OBJECT * aspectratioCB, + external::ResizeData const & data) +{ + BOOST_ASSERT(widthED && widthED->objclass == FL_INPUT); + BOOST_ASSERT(widthUnitCO && widthUnitCO->objclass == FL_CHOICE); + BOOST_ASSERT(heightED && heightED->objclass == FL_INPUT); + BOOST_ASSERT(heightUnitCO && heightUnitCO->objclass == FL_CHOICE); + BOOST_ASSERT(aspectratioCB && + aspectratioCB->objclass == FL_CHECKBUTTON); + + bool using_scale = data.usingScale(); + double scale = data.scale; + if (data.no_resize()) { + // Everything is zero, so default to this! + using_scale = true; + scale = 100; + } + + if (using_scale) { + fl_set_input(widthED, tostr(scale).c_str()); + fl_set_choice(widthUnitCO, 1); + } else { + fl_set_input(widthED, tostr(data.width.value()).c_str()); + // Because 'Scale' is position 1... + // Note also that width cannot be zero here, so + // we don't need to worry about the default unit. + fl_set_choice(widthUnitCO, data.width.unit() + 2); + } + + string const h = data.height.zero() ? string() : data.height.asString(); + LyXLength::UNIT default_unit = data.width.zero() ? + defaultUnit() : data.width.unit(); + updateWidgetsFromLengthString(heightED, heightUnitCO, + h, stringFromUnit(default_unit)); + + setEnabled(heightED, !using_scale); + setEnabled(heightUnitCO, !using_scale); + + fl_set_button(aspectratioCB, data.keepAspectRatio); + + bool const disable_aspectRatio = using_scale || + data.width.zero() || data.height.zero(); + setEnabled(aspectratioCB, !disable_aspectRatio); +} + + +void getSize(external::ResizeData & data, + FL_OBJECT * widthED, FL_OBJECT * widthUnitCO, + FL_OBJECT * heightED, FL_OBJECT * heightUnitCO, + FL_OBJECT * aspectratioCB) +{ + BOOST_ASSERT(widthED && widthED->objclass == FL_INPUT); + BOOST_ASSERT(widthUnitCO && widthUnitCO->objclass == FL_CHOICE); + BOOST_ASSERT(heightED && heightED->objclass == FL_INPUT); + BOOST_ASSERT(heightUnitCO && heightUnitCO->objclass == FL_CHOICE); + BOOST_ASSERT(aspectratioCB && + aspectratioCB->objclass == FL_CHECKBUTTON); + + string const width = getString(widthED); + + if (fl_get_choice(widthUnitCO) > 1) { + // Subtract one, because scale is 1. + int const unit = fl_get_choice(widthUnitCO) - 1; + + LyXLength w; + if (isValidLength(width, &w)) + data.width = w; + else if (isStrDbl(width)) + data.width = LyXLength(strToDbl(width), + static_cast(unit)); + else + data.width = LyXLength(); + + data.scale = 0.0; + + } else { + // scaling instead of a width + data.scale = strToDbl(width); + data.width = LyXLength(); + } + + data.height = LyXLength(getLengthFromWidgets(heightED, heightUnitCO)); + + data.keepAspectRatio = fl_get_button(aspectratioCB); +} + + +void setCrop(FL_OBJECT * clipCB, + FL_OBJECT * xlED, FL_OBJECT * ybED, + FL_OBJECT * xrED, FL_OBJECT * ytED, + external::ClipData const & data) +{ + BOOST_ASSERT(clipCB && clipCB->objclass == FL_CHECKBUTTON); + BOOST_ASSERT(xlED && xlED->objclass == FL_INPUT); + BOOST_ASSERT(ybED && ybED->objclass == FL_INPUT); + BOOST_ASSERT(xrED && xrED->objclass == FL_INPUT); + BOOST_ASSERT(ytED && ytED->objclass == FL_INPUT); + + fl_set_button(clipCB, data.clip); + lyx::graphics::BoundingBox const & bbox = data.bbox; + fl_set_input(xlED, tostr(bbox.xl).c_str()); + fl_set_input(ybED, tostr(bbox.yb).c_str()); + fl_set_input(xrED, tostr(bbox.xr).c_str()); + fl_set_input(ytED, tostr(bbox.yt).c_str()); +} + + +void getCrop(external::ClipData & data, + FL_OBJECT * clipCB, + FL_OBJECT * xlED, FL_OBJECT * ybED, + FL_OBJECT * xrED, FL_OBJECT * ytED, + bool bb_changed) +{ + BOOST_ASSERT(clipCB && clipCB->objclass == FL_CHECKBUTTON); + BOOST_ASSERT(xlED && xlED->objclass == FL_INPUT); + BOOST_ASSERT(ybED && ybED->objclass == FL_INPUT); + BOOST_ASSERT(xrED && xrED->objclass == FL_INPUT); + BOOST_ASSERT(ytED && ytED->objclass == FL_INPUT); + + data.clip = fl_get_button(clipCB); + + if (!bb_changed) + return; + + data.bbox.xl = strToInt(getString(xlED)); + data.bbox.yb = strToInt(getString(ybED)); + data.bbox.xr = strToInt(getString(xrED)); + data.bbox.yt = strToInt(getString(ytED)); +} + + +void getExtra(external::ExtraData & data, + FormExternal::MapType const & extra) +{ + typedef FormExternal::MapType MapType; + MapType::const_iterator it = extra.begin(); + MapType::const_iterator const end = extra.end(); + for (; it != end; ++it) + data.set(it->first, trim(it->second)); +} + +} // namespace anon typedef FormController > base_class; @@ -43,166 +322,177 @@ FormExternal::FormExternal(Dialog & parent) {} -void FormExternal::apply() -{ - InsetExternalParams params = controller().params(); - - string const buffer_path = kernel().bufferFilepath(); - params.filename.set(getString(dialog_->input_filename), buffer_path); - - int const choice = fl_get_choice(dialog_->choice_template) - 1; - params.settemplate(controller().getTemplate(choice).lyxName); - - params.lyxscale = strToInt(getString(dialog_->input_lyxscale)); - if (params.lyxscale == 0) - params.lyxscale = 100; - - switch (fl_get_choice(dialog_->choice_display)) { - case 6: - params.display = lyx::external::NoDisplay; - break; - case 5: - params.display = lyx::external::PreviewDisplay; - break; - case 4: - params.display = lyx::external::ColorDisplay; - break; - case 3: - params.display = lyx::external::GrayscaleDisplay; - break; - case 2: - params.display = lyx::external::MonochromeDisplay; - break; - case 1: - params.display = lyx::external::DefaultDisplay; - } - - std::map::const_iterator it = extra_.begin(); - std::map::const_iterator end = extra_.end(); - for (; it != end; ++it) - params.extradata.set(it->first, trim(it->second)); - - controller().setParams(params); -} - - void FormExternal::build() { dialog_.reset(build_external(this)); + file_.reset(build_external_file(this)); + lyxview_.reset(build_external_lyxview(this)); + rotate_.reset(build_external_rotate(this)); + scale_.reset(build_external_scale(this)); + crop_.reset(build_external_crop(this)); + options_.reset(build_external_options(this)); - string const choice = - ' ' + getStringFromVector(controller().getTemplates(), " | ") + ' '; - fl_addto_choice(dialog_->choice_template, choice.c_str()); - - fl_set_input_return (dialog_->input_filename, FL_RETURN_CHANGED); - - // Disable for read-only documents. - bcview().addReadOnly(dialog_->input_filename); - bcview().addReadOnly(dialog_->button_browse); - bcview().addReadOnly(dialog_->input_extra); - - // Trigger an input event for cut&paste with middle mouse button. - setPrehandler(dialog_->input_filename); - - // Activate ok/apply immediately upon input. - fl_set_input_return(dialog_->input_filename, FL_RETURN_CHANGED); - fl_set_input_return(dialog_->input_lyxscale, FL_RETURN_CHANGED); - fl_set_input_return(dialog_->input_extra, FL_RETURN_CHANGED); - fl_set_input_return(dialog_->input_lyxscale, FL_RETURN_CHANGED); - - fl_set_input_filter(dialog_->input_lyxscale, fl_unsigned_int_filter); - - string const display_List = - _("Default|Monochrome|Grayscale|Color|Preview|Do not display"); - fl_addto_choice(dialog_->choice_display, display_List.c_str()); - - // Set up the tooltips. - string str = _("The file you want to insert."); - tooltips().init(dialog_->input_filename, str); - str = _("Browse the directories."); - tooltips().init(dialog_->button_browse, str); - - str = _("Scale the image to inserted percentage value."); - tooltips().init(dialog_->input_lyxscale, str); - str = _("Select display mode for this image."); - tooltips().init(dialog_->choice_display, str); - - // Manage the ok, apply and cancel/close buttons bcview().setOK(dialog_->button_ok); bcview().setApply(dialog_->button_apply); bcview().setCancel(dialog_->button_close); + + bcview().addReadOnly(file_->input_file); + bcview().addReadOnly(file_->button_browse); + bcview().addReadOnly(file_->button_edit); + bcview().addReadOnly(file_->choice_template); + + bcview().addReadOnly(lyxview_->check_show); + bcview().addReadOnly(lyxview_->choice_show); + bcview().addReadOnly(lyxview_->input_displayscale); + + bcview().addReadOnly(rotate_->input_angle); + bcview().addReadOnly(rotate_->choice_origin); + + bcview().addReadOnly(scale_->input_width); + bcview().addReadOnly(scale_->choice_width); + bcview().addReadOnly(scale_->input_height); + bcview().addReadOnly(scale_->choice_height); + bcview().addReadOnly(scale_->check_aspectratio); + + bcview().addReadOnly(crop_->check_bbox); + bcview().addReadOnly(crop_->button_get_bbox); + bcview().addReadOnly(crop_->input_xr); + bcview().addReadOnly(crop_->input_yt); + bcview().addReadOnly(crop_->input_xl); + bcview().addReadOnly(crop_->input_yb); + + bcview().addReadOnly(options_->choice_option); + bcview().addReadOnly(options_->input_option); + + // initial setting +// addCheckedPositiveFloat(bcview(), scale_->input_width); + // As I haven't written addCheckedPositiveFloat, we default to + // always checking that it is a valide LyXLength, even when + // I'm 'scaling'. No harm done, just not as strict as it might be. + addCheckedLyXLength(bcview(), scale_->input_width); + addCheckedLyXLength(bcview(), scale_->input_height); + +// addCheckedPositiveFloat(bcview(), input_displayscale); + fl_set_input_filter(lyxview_->input_displayscale, + fl_unsigned_int_filter); + + fl_set_input_filter(crop_->input_xr, fl_unsigned_int_filter); + fl_set_input_filter(crop_->input_yt, fl_unsigned_int_filter); + fl_set_input_filter(crop_->input_xl, fl_unsigned_int_filter); + fl_set_input_filter(crop_->input_yb, fl_unsigned_int_filter); + + fl_set_input_return(file_->input_file, FL_RETURN_CHANGED); + fl_set_input_return(lyxview_->input_displayscale, FL_RETURN_CHANGED); + fl_set_input_return(rotate_->input_angle, FL_RETURN_CHANGED); + fl_set_input_return(scale_->input_width, FL_RETURN_CHANGED); + fl_set_input_return(scale_->input_height, FL_RETURN_CHANGED); + fl_set_input_return(crop_->input_xr, FL_RETURN_CHANGED); + fl_set_input_return(crop_->input_yt, FL_RETURN_CHANGED); + fl_set_input_return(crop_->input_xl, FL_RETURN_CHANGED); + fl_set_input_return(crop_->input_yb, FL_RETURN_CHANGED); + fl_set_input_return(options_->input_option, FL_RETURN_CHANGED); + + // Trigger an input event for cut&paste with middle mouse button. + setPrehandler(file_->input_file); + setPrehandler(lyxview_->input_displayscale); + setPrehandler(rotate_->input_angle); + setPrehandler(scale_->input_width); + setPrehandler(scale_->input_height); + setPrehandler(crop_->input_xr); + setPrehandler(crop_->input_yt); + setPrehandler(crop_->input_xl); + setPrehandler(crop_->input_yb); + setPrehandler(options_->input_option); + + string const choice = + ' ' + getStringFromVector(controller().getTemplates(), " | ") + + ' '; + fl_addto_choice(file_->choice_template, choice.c_str()); + + string const display_list = + _("Default|Monochrome|Grayscale|Color|Preview"); + fl_addto_choice(lyxview_->choice_show, display_list.c_str()); + + // Fill the origins combo + typedef vector Origins; + Origins const & all_origins = external::all_origins(); + for (Origins::size_type i = 0; i != all_origins.size(); ++i) + fl_addto_choice(rotate_->choice_origin, + external::origin_gui_str(i).c_str()); + + string const width_list = bformat(_("Scale%%%%|%1$s"), + choice_Length_All); + fl_addto_choice(scale_->choice_width, width_list.c_str()); + + fl_addto_choice(scale_->choice_height, choice_Length_All.c_str()); + + // Set up the tooltips. + string str = _("The file you want to insert."); + tooltips().init(file_->input_file, str); + str = _("Browse the directories."); + tooltips().init(file_->button_browse, str); + + str = _("Scale the image to inserted percentage value."); + tooltips().init(lyxview_->input_displayscale, str); + str = _("Select display mode for this image."); + tooltips().init(options_->choice_option, str); + + // Stack tabs + tabmap_[FILETAB] = + fl_addto_tabfolder(dialog_->tabfolder, _("File").c_str(), + file_->form); + + tabmap_[LYXVIEWTAB] = + fl_addto_tabfolder(dialog_->tabfolder, _("LyX View").c_str(), + lyxview_->form); + tabmap_[ROTATETAB] = + fl_addto_tabfolder(dialog_->tabfolder, _("Rotate").c_str(), + rotate_->form); + tabmap_[SCALETAB] = + fl_addto_tabfolder(dialog_->tabfolder, _("Scale").c_str(), + scale_->form); + tabmap_[CROPTAB] = + fl_addto_tabfolder(dialog_->tabfolder, _("Crop").c_str(), + crop_->form); + tabmap_[OPTIONSTAB] = + fl_addto_tabfolder(dialog_->tabfolder, _("Options").c_str(), + options_->form); } void FormExternal::update() { + fl_set_folder_bynumber(dialog_->tabfolder, 1); InsetExternalParams const & params = controller().params(); string const buffer_path = kernel().bufferFilepath(); string const name = params.filename.outputFilename(buffer_path); - fl_set_input(dialog_->input_filename, name.c_str()); + fl_set_input(file_->input_file, name.c_str()); int ID = controller().getTemplateNumber(params.templatename()); if (ID < 0) ID = 0; - fl_set_choice(dialog_->choice_template, ID+1); + fl_set_choice(file_->choice_template, ID+1); updateComboChange(); - fl_set_input(dialog_->input_lyxscale, tostr(params.lyxscale).c_str()); + setDisplay(lyxview_->check_show, lyxview_->choice_show, + lyxview_->input_displayscale, + params.display, params.lyxscale, + kernel().isBufferReadonly()); - switch (params.display) { - case lyx::external::NoDisplay: - fl_set_choice(dialog_->choice_display, 6); - break; - case lyx::external::PreviewDisplay: - fl_set_choice(dialog_->choice_display, 5); - break; - case lyx::external::ColorDisplay: - fl_set_choice(dialog_->choice_display, 4); - break; - case lyx::external::GrayscaleDisplay: - fl_set_choice(dialog_->choice_display, 3); - break; - case lyx::external::MonochromeDisplay: - fl_set_choice(dialog_->choice_display, 2); - break; - case lyx::external::DefaultDisplay: - fl_set_choice(dialog_->choice_display, 1); - } -} + setRotation(rotate_->input_angle, rotate_->choice_origin, + params.rotationdata); + setSize(scale_->input_width, scale_->choice_width, + scale_->input_height, scale_->choice_height, + scale_->check_aspectratio, + params.resizedata); -ButtonPolicy::SMInput FormExternal::input(FL_OBJECT * ob, long) -{ - ButtonPolicy::SMInput result = ButtonPolicy::SMI_VALID; - if (ob == dialog_->choice_template) { - - // set to the chosen template - updateComboChange(); - - } else if (ob == dialog_->button_browse) { - - string const in_name = fl_get_input(dialog_->input_filename); - string const out_name = controller().Browse(in_name); - fl_set_input(dialog_->input_filename, out_name.c_str()); - - } else if (ob == dialog_->button_edit) { - controller().editExternal(); - result = ButtonPolicy::SMI_NOOP; - - } else if (ob == dialog_->input_extra) { - string const format = - fl_get_choice_text(dialog_->choice_extra_format); - extra_[format] = getString(dialog_->input_extra); - - } else if (ob == dialog_->choice_extra_format) { - string const format = - fl_get_choice_text(dialog_->choice_extra_format); - fl_set_input(dialog_->input_extra, extra_[format].c_str()); - result = ButtonPolicy::SMI_NOOP; - } - - return result; + setCrop(crop_->check_bbox, + crop_->input_xl, crop_->input_yb, + crop_->input_xr, crop_->input_yt, + params.clipdata); + controller().bbChanged(!params.clipdata.bbox.empty()); } @@ -210,20 +500,49 @@ void FormExternal::updateComboChange() { namespace external = lyx::external; - int const choice = fl_get_choice(dialog_->choice_template) - 1; + int const choice = fl_get_choice(file_->choice_template) - 1; external::Template templ = controller().getTemplate(choice); // Update the help text string const txt = formatted(templ.helpText, - dialog_->browser_helptext->w - 20); - fl_clear_browser(dialog_->browser_helptext); - fl_addto_browser(dialog_->browser_helptext, txt.c_str()); - fl_set_browser_topline(dialog_->browser_helptext, 0); + file_->browser_template->w - 20); + fl_clear_browser(file_->browser_template); + fl_addto_browser(file_->browser_template, txt.c_str()); + fl_set_browser_topline(file_->browser_template, 0); + + // Ascertain which (if any) transformations the template supports + // and disable tabs hosting unsupported transforms. + typedef vector TransformIDs; + TransformIDs const transformIds = templ.transformIds; + TransformIDs::const_iterator tr_begin = transformIds.begin(); + TransformIDs::const_iterator const tr_end = transformIds.end(); + + tabmap_[FILETAB]; + tabmap_[LYXVIEWTAB]; + tabmap_[ROTATETAB]; + tabmap_[SCALETAB]; + tabmap_[CROPTAB]; + tabmap_[OPTIONSTAB]; + + bool found = find(tr_begin, tr_end, external::Rotate) != tr_end; + setEnabled(tabmap_[ROTATETAB], found); + + found = find(tr_begin, tr_end, external::Resize) != tr_end; + setEnabled(tabmap_[SCALETAB], found); + + found = find(tr_begin, tr_end, external::Clip) != tr_end; + setEnabled(tabmap_[CROPTAB], found); + + found = find(tr_begin, tr_end, external::Extra) != tr_end; + setEnabled(tabmap_[OPTIONSTAB], found); + + if (!found) + return; // Ascertain whether the template has any formats supporting // the 'Extra' option - FL_OBJECT * const ob_input = dialog_->input_extra; - FL_OBJECT * const ob_choice = dialog_->choice_extra_format; + FL_OBJECT * const ob_input = options_->input_option; + FL_OBJECT * const ob_choice = options_->choice_option; extra_.clear(); fl_set_input(ob_input, ""); fl_clear_choice(ob_choice); @@ -242,6 +561,7 @@ void FormExternal::updateComboChange() bool const enabled = fl_get_choice_maxitems(ob_choice) > 0; + setEnabled(tabmap_[OPTIONSTAB], enabled); setEnabled(ob_input, enabled && !kernel().isBufferReadonly()); setEnabled(ob_choice, enabled); @@ -251,3 +571,174 @@ void FormExternal::updateComboChange() fl_set_input(ob_input, extra_[format].c_str()); } } + + +void FormExternal::apply() +{ + InsetExternalParams params = controller().params(); + + string const buffer_path = kernel().bufferFilepath(); + params.filename.set(getString(file_->input_file), buffer_path); + + int const choice = fl_get_choice(file_->choice_template) - 1; + params.settemplate(controller().getTemplate(choice).lyxName); + + getDisplay(params.display, params.lyxscale, + lyxview_->check_show, lyxview_->choice_show, + lyxview_->input_displayscale); + + if (isActive(tabmap_[ROTATETAB])) + getRotation(params.rotationdata, + rotate_->input_angle, rotate_->choice_origin); + + if (isActive(tabmap_[SCALETAB])) + getSize(params.resizedata, + scale_->input_width, scale_->choice_width, + scale_->input_height, scale_->choice_height, + scale_->check_aspectratio); + + if (isActive(tabmap_[CROPTAB])) + getCrop(params.clipdata, + crop_->check_bbox, + crop_->input_xl, crop_->input_yb, + crop_->input_xr, crop_->input_yt, + controller().bbChanged()); + + if (isActive(tabmap_[OPTIONSTAB])) + getExtra(params.extradata, extra_); + + controller().setParams(params); +} + + +ButtonPolicy::SMInput FormExternal::input(FL_OBJECT * ob, long) +{ + ButtonPolicy::SMInput result = ButtonPolicy::SMI_VALID; + + if (ob == file_->choice_template) { + + // set to the chosen template + updateComboChange(); + + } else if (ob == file_->button_browse) { + + string const in_name = fl_get_input(file_->input_file); + string const out_name = controller().Browse(in_name); + fl_set_input(file_->input_file, out_name.c_str()); + + } else if (ob == file_->button_edit) { + controller().editExternal(); + result = ButtonPolicy::SMI_NOOP; + + } else if (ob == lyxview_->check_show) { + + bool const checked = fl_get_button(ob); + setEnabled(lyxview_->choice_show, checked); + setEnabled(lyxview_->input_displayscale, checked); + + } else if (ob == crop_->button_get_bbox) { + + getBB(); + + } else if (ob == scale_->input_width || + ob == scale_->input_height) { + + setEnabled(scale_->check_aspectratio, + activateAspectratio()); + + } else if (ob == scale_->choice_width) { + + widthUnitChanged(); + + } else if (ob == crop_->input_xr || + ob == crop_->input_yt || + ob == crop_->input_xl || + ob == crop_->input_yb) { + + controller().bbChanged(true); + + } else if (ob == options_->input_option) { + + string const format = + fl_get_choice_text(options_->choice_option); + extra_[format] = getString(options_->input_option); + + } else if (ob == options_->choice_option) { + + string const format = + fl_get_choice_text(options_->choice_option); + fl_set_input(options_->input_option, extra_[format].c_str()); + result = ButtonPolicy::SMI_NOOP; + } + + return result; +} + + +bool FormExternal::activateAspectratio() const +{ + if (fl_get_choice(scale_->choice_width) == 1) + return false; + + string const wstr = getString(scale_->input_width); + if (wstr.empty()) + return false; + bool const wIsDbl = isStrDbl(wstr); + if (wIsDbl && float_equal(strToDbl(wstr), 0.0, 0.05)) + return false; + LyXLength l; + if (!wIsDbl && (!isValidLength(wstr, &l) || l.zero())) + return false; + + string const hstr = getString(scale_->input_height); + if (hstr.empty()) + return false; + bool const hIsDbl = isStrDbl(hstr); + if (hIsDbl && float_equal(strToDbl(hstr), 0.0, 0.05)) + return false; + if (!hIsDbl && (!isValidLength(hstr, &l) || l.zero())) + return false; + + return true; +} + + +void FormExternal::getBB() +{ + fl_set_input(crop_->input_xl, "0"); + fl_set_input(crop_->input_yb, "0"); + fl_set_input(crop_->input_xr, "0"); + fl_set_input(crop_->input_yt, "0"); + + string const filename = getString(file_->input_file); + if (filename.empty()) + return; + + string const bb = controller().readBB(filename); + if (bb.empty()) + return; + + fl_set_input(crop_->input_xl, token(bb, ' ', 0).c_str()); + fl_set_input(crop_->input_yb, token(bb, ' ', 1).c_str()); + fl_set_input(crop_->input_xr, token(bb, ' ', 2).c_str()); + fl_set_input(crop_->input_yt, token(bb, ' ', 3).c_str()); + + controller().bbChanged(false); +} + + +void FormExternal::widthUnitChanged() +{ + if (fl_get_choice(scale_->choice_width) == 1) + return; + + bool useHeight = fl_get_choice(scale_->choice_width) > 1; + +// if (useHeight) +// widthED->setValidator(unsignedLengthValidator(widthED)); +// else +// widthED->setValidator(new QDoubleValidator(0, 1000, 2, widthED)); + + setEnabled(scale_->input_height, useHeight); + setEnabled(scale_->choice_height, useHeight); +} diff --git a/src/frontends/xforms/FormExternal.h b/src/frontends/xforms/FormExternal.h index 06794df91d..80296f3c3b 100644 --- a/src/frontends/xforms/FormExternal.h +++ b/src/frontends/xforms/FormExternal.h @@ -18,9 +18,14 @@ #include "FormDialogView.h" #include - class ControlExternal; struct FD_external; +struct FD_external_file; +struct FD_external_lyxview; +struct FD_external_rotate; +struct FD_external_scale; +struct FD_external_crop; +struct FD_external_options; /// The class for editing External insets via a dialog class FormExternal @@ -28,6 +33,20 @@ class FormExternal public: /// FormExternal(Dialog &); + + typedef std::map MapType; + + enum Tabs { + FILETAB, + LYXVIEWTAB, + ROTATETAB, + SCALETAB, + CROPTAB, + OPTIONSTAB + }; + + typedef std::map TabMap; + private: /// apply changes virtual void apply(); @@ -41,10 +60,22 @@ private: /// Filter the inputs on callback from xforms virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); - /// + bool activateAspectratio() const; + void getBB(); void updateComboChange(); + void widthUnitChanged(); - std::map extra_; + MapType extra_; + + TabMap tabmap_; + + /// Real GUI implementation. + boost::scoped_ptr file_; + boost::scoped_ptr lyxview_; + boost::scoped_ptr rotate_; + boost::scoped_ptr scale_; + boost::scoped_ptr crop_; + boost::scoped_ptr options_; }; #endif // FORMEXTERNAL_H diff --git a/src/frontends/xforms/forms/form_external.fd b/src/frontends/xforms/forms/form_external.fd index 7044aac663..a78bec86ee 100644 --- a/src/frontends/xforms/forms/form_external.fd +++ b/src/frontends/xforms/forms/form_external.fd @@ -3,20 +3,20 @@ Magic: 13000 Internal Form Definition File (do not change) -Number of forms: 1 +Number of forms: 7 Unit of measure: FL_COORD_PIXEL SnapGrid: 5 =============== FORM =============== Name: form_external -Width: 395 -Height: 445 -Number of Objects: 16 +Width: 385 +Height: 305 +Number of Objects: 5 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 395 445 +box: 0 0 385 305 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -32,225 +32,27 @@ callback: argument: -------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 140 5 160 25 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_RIGHT_BCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Template:|#T -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NorthWest FL_NorthEast -name: choice_template -callback: C_FormDialogView_InputCB -argument: 0 - --------------------- -class: FL_BROWSER -type: NORMAL_BROWSER -box: 10 35 380 140 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_TOP +class: FL_TABFOLDER +type: TOP_TABFOLDER +box: 5 5 375 255 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_TOP_LEFT style: FL_NORMAL_STYLE size: FL_DEFAULT_SIZE lcol: FL_BLACK label: shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NorthWest FL_SouthEast -name: browser_helptext -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 90 195 195 25 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: File:|#F -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_SouthWest FL_SouthEast -name: input_filename -callback: C_FormDialogView_InputCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 290 195 100 25 -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: Browse...|#B -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_SouthEast FL_SouthEast -name: button_browse -callback: C_FormDialogView_InputCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 290 230 100 25 -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: Edit file|#E -shortcut: resize: FL_RESIZE_NONE -gravity: FL_SouthEast FL_SouthEast -name: button_edit -callback: C_FormDialogView_InputCB -argument: 0 - --------------------- -class: FL_LABELFRAME -type: ENGRAVED_FRAME -box: 5 270 385 55 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: LyX View -shortcut: -resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity -name: +name: tabfolder callback: argument: --------------------- -class: FL_TEXT -type: NORMAL_TEXT -box: 155 285 25 25 -boxtype: FL_FLAT_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: % -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_East FL_East -name: -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 85 285 70 25 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Scale:|#S -shortcut: -resize: FL_RESIZE_X -gravity: FL_West FL_East -name: input_lyxscale -callback: C_FormDialogView_InputCB -argument: 0 - --------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 265 285 115 25 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Display:|#D -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_East FL_East -name: choice_display -callback: C_FormDialogView_InputCB -argument: 0 - --------------------- -class: FL_LABELFRAME -type: ENGRAVED_FRAME -box: 5 340 385 55 -boxtype: FL_NO_BOX -colors: FL_BLACK FL_COL1 -alignment: FL_ALIGN_TOP_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Output options -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 85 355 125 25 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Option|#O -shortcut: -resize: FL_RESIZE_X -gravity: FL_West FL_East -name: input_extra -callback: C_FormDialogView_InputCB -argument: 0 - --------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 265 355 115 25 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Format|#t -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_East FL_East -name: choice_extra_format -callback: C_FormDialogView_InputCB -argument: 0 - -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 110 410 90 25 +box: 100 270 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -268,7 +70,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 205 410 90 25 +box: 195 270 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -286,7 +88,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 300 410 90 25 +box: 290 270 90 25 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -301,5 +103,617 @@ name: button_close callback: C_FormDialogView_CancelCB argument: 0 +=============== FORM =============== +Name: form_external_file +Width: 375 +Height: 235 +Number of Objects: 6 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 375 235 +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: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 50 15 210 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: File:|#F +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_file +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 265 15 100 25 +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: Browse...|#B +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_browse +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 265 45 100 25 +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: Edit File...|#E +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_edit +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 140 80 120 25 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Template:|#T +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_template +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_BROWSER +type: NORMAL_BROWSER +box: 25 115 325 105 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: browser_template +callback: +argument: + +=============== FORM =============== +Name: form_external_lyxview +Width: 375 +Height: 235 +Number of Objects: 5 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 375 235 +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: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 30 20 170 25 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Show in LyX|#S +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: check_show +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 30 70 155 25 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Display:|#D +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_show +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 205 70 120 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Scale|#l +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_displayscale +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 325 65 25 30 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: % +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +=============== FORM =============== +Name: form_external_rotate +Width: 375 +Height: 235 +Number of Objects: 3 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 375 235 +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: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 75 40 120 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Angle|#n +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_angle +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 250 40 90 25 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Origin|#O +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_origin +callback: C_FormDialogView_InputCB +argument: 0 + +=============== FORM =============== +Name: form_external_scale +Width: 375 +Height: 235 +Number of Objects: 6 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 375 235 +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: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 95 40 125 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Width|#W +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_width +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 230 40 95 25 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_width +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 95 75 125 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Height|#H +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_height +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 230 75 95 25 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_height +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 95 110 205 25 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Maintain aspect ratio|#M +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: check_aspectratio +callback: C_FormDialogView_InputCB +argument: 0 + +=============== FORM =============== +Name: form_external_crop +Width: 375 +Height: 235 +Number of Objects: 9 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 375 235 +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: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 100 65 30 20 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: x +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_TEXT +type: NORMAL_TEXT +box: 210 65 30 20 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: y +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 30 20 170 25 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Clip to bounding box|#b +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: check_bbox +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 215 20 135 25 +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: Get from File|#G +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_get_bbox +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 100 85 100 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Right top|#t +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_xr +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 210 85 100 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_yt +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 100 120 100 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Left bottom|#L +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_xl +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 210 120 100 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_yb +callback: C_FormDialogView_InputCB +argument: 0 + +=============== FORM =============== +Name: form_external_options +Width: 375 +Height: 235 +Number of Objects: 3 + +-------------------- +class: FL_BOX +type: UP_BOX +box: 0 0 375 235 +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: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: +callback: +argument: + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 40 50 90 25 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Format|#t +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_option +callback: C_FormDialogView_InputCB +argument: 0 + +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 140 50 210 25 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_TOP_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Option|#p +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_option +callback: C_FormDialogView_InputCB +argument: 0 + ============================== create_the_forms