DEFINE_EVENT_TYPE(wxEVT_TILE_PREVIEW)
60{ -1.0f, 215.9f/279.4f, 210.0f/297.0f};
67, m_DirSelectButton(
NULL)
68, m_FileRootName(
NULL)
69, m_ImageFormat(
NULL)
70, m_NumberingFormat(
NULL)
72, m_ImageSizes(
NULL)
73, m_ImageSaver(img_saver)
80wxWindowList& children = this->GetChildren();
82wxWindowList::compatibility_iterator node = children.GetFirst();
85wxWindow *child = node->GetData();
87 if(child->GetId() == GetAffirmativeId()) {
88child->SetLabel(
wxT(
"Save"));
91 else if(child->GetId() == wxID_CANCEL) {
92child->SetLabel(
wxT(
"Close"));
96 else if(child->GetLabel() ==
wxT(
"Printer...")) {
101node = node->GetNext();
112 intfname_width = 60;
117wxBoxSizer *file_sizer =
newwxBoxSizer(wxHORIZONTAL);
118file_sizer->Add(
newwxStaticText(
this,
120 wxT(
"Directory:")),
1210, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER,5);
126wxSize(dir_width, wxDefaultCoord));
127file_sizer->Add(
m_Directory, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER, 5 );
131wxArtProvider::GetBitmap(
wxT(
"menu::open")),
136file_sizer->Add(
m_DirSelectButton, 0, wxTOP|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER, 5 );
138file_sizer->Add(
newwxStaticText(
this,
140 wxT(
"File Name:")),
1410,wxTOP|wxBOTTOM|wxALIGN_CENTER,5);
146wxSize(fname_width, wxDefaultCoord));
148file_sizer->Add(
m_FileRootName, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER, 5);
151file_sizer->Add(
newwxStaticText(
this,
153 wxT(
"Numbering:")),
1541,wxTOP|wxBOTTOM|wxALIGN_CENTER,5);
156 intnumbering_count = 2;
157wxString* num_choices =
newwxString[numbering_count];
158num_choices[0] =
wxT(
"Sequential");
159num_choices[1] =
wxT(
"Tile Index");
165wxSize(100, wxDefaultCoord),
166numbering_count, num_choices);
167file_sizer->Add(
m_NumberingFormat, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER, 5);
170mainsizer->Add( file_sizer, 0, wxALIGN_CENTER);
171wxBoxSizer *image_opt_sizer =
newwxBoxSizer(wxHORIZONTAL);
173image_opt_sizer->Add(
newwxStaticText(
this,
175 wxT(
"Image Type:")),
1761,wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER,5);
180 intformat_count = 3;
181wxString* choices =
newwxString[format_count];
182choices[0] =
wxT(
"jpeg");
183choices[1] =
wxT(
"png");
191wxSize(80, wxDefaultCoord),
192format_count, choices);
193image_opt_sizer->Add(
m_ImageFormat, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER, 5);
197std::vector<int> sizes;
199wxString* size_choices =
NULL;
202 if(sizes.size() > 0) {
203size_choices =
newwxString[sizes.size()];
204 for(
size_t i=0;
i<sizes.size(); ++
i) {
206sprintf(
buf,
"%5d", sizes[
i]);
207size_choices[
i] = wxString(
buf, wxConvUTF8);
209 if(size_choices->size() > 1U)
215sizes.push_back(256);
216size_choices =
newwxString[sizes.size()];
218sprintf(
buf,
"%5d", sizes[0]);
219size_choices[0] = wxString(
buf, wxConvUTF8);
222image_opt_sizer->Add(
newwxStaticText(
this,
224 wxT(
"Image Size:")),
2251,wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER,5);
228size_choices[default_idx],
230wxSize(80, wxDefaultCoord),
231(
int)sizes.size(), size_choices);
232image_opt_sizer->Add(
m_ImageSizes, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER, 5);
234image_opt_sizer->Add(
newwxStaticText(
this,
236 wxT(
"Proportions:")),
2371,wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER,5);
240wxString* ratio_choices =
newwxString[ratio_count];
243ratio_choices[0] =
wxT(
"Smallest");
244ratio_choices[1] =
wxT(
"Letter");
245ratio_choices[2] =
wxT(
"A4");
251wxSize(100, wxDefaultCoord),
252ratio_count, ratio_choices);
253image_opt_sizer->Add(
m_SizeRatio, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER, 5);
256mainsizer->Add( image_opt_sizer, 0, wxALIGN_CENTER);
266reg_value = view.
GetString(
"ImageDirectory");
267 if(!reg_value.empty())
268 m_Directory->SetValue(wxString(reg_value.c_str(), wxConvUTF8));
270reg_value = view.
GetString(
"FileRootName");
271 if(!reg_value.empty())
272 m_FileRootName->SetValue(wxString(reg_value.c_str(), wxConvUTF8));
274reg_value = view.
GetString(
"ImageFormat");
275 if(!reg_value.empty())
276 m_ImageFormat->SetValue(wxString(reg_value.c_str(), wxConvUTF8));
279reg_value = view.
GetString(
"NumberingFormat");
280 if(!reg_value.empty())
283reg_value = view.
GetString(
"SizeRatio");
284wxString wx_reg_value = wxString(reg_value.c_str(), wxConvUTF8);
285 if(!reg_value.empty())
287 for(
intj=0; j<ratio_count; ++j) {
288 if(wx_reg_value == ratio_choices[j]) {
296wxCommandEvent dummy_evt;
306 if(ratio == -1.0f)
returnratio;
312 if((ratio < 1.0f && target_ratio > 1.0f) || (ratio > 1.0f && target_ratio < 1.0f))
342wxDirDialog dlg(
this);
344 if(dlg.ShowModal() == wxID_OK) {
420SetCursor(*wxHOURGLASS_CURSOR);
464SetCursor(*wxSTANDARD_CURSOR);
467wxMessageBox(
wxT(
"Graphics system does not support in-memory image save feature"),
468 wxT(
"Error Saving"), wxOK);
471wxMessageBox(
wxT(
"File error occured during save. Make sure file and directory names are valid."),
472 wxT(
"Error Saving"), wxOK);
486SetCursor(*wxHOURGLASS_CURSOR);
515 CVect2<int>(event.GetInt(),
static_cast<int>(event.GetExtraLong())),
519SetCursor(*wxSTANDARD_CURSOR);
531SetCursor(*wxHOURGLASS_CURSOR);
564SetCursor(*wxSTANDARD_CURSOR);
static std::vector< int > checkFramebufferAvailability(int start_size, int count)
Return an arrray of valid image output sizes.
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
void x_InitDialog(CRef< CImage > img)
Layout all controls owned by this class.
virtual void UpdateMargins()
virtual bool TransferDataFromWindow()
CVect2< int > GetPartitions() const
Get the number of image partitions in x and y.
wxStaticText * m_PageCount
wxSlider * m_PageCountSlider
CGlPreviewSetupWidget * m_PreviewSetupWidget
wxRadioBox * m_GuidesRadioBox
virtual bool TransferDataToWindow()
class CRegistryReadView provides a nested hierarchical view at a particular key.
string GetString(const string &key, const string &default_val=kEmptyStr) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
void OnPreview(wxCommandEvent &event)
void OnPrinter(wxCommandEvent &event)
void OnFileTextChange(wxCommandEvent &evt)
Called to update image on screen.
wxTextCtrl * m_Directory
Directory in which to save the image.
wxComboBox * m_SizeRatio
Size ratio derived from ouput format - US Letter, A4, ...
void OnImageTypeChange(wxCommandEvent &event)
wxComboBox * m_ImageSizes
Output size (this will be the size of larger dimension in output images)
wxButton * m_DirSelectButton
IImageGrabber * m_ImageSaver
std::string GetOutputFormat() const
std::string GetDirectoryName() const
void OnDirSelect(wxCommandEvent &event)
std::string GetNumberingFormat() const
std::string GetImageFormat() const
void OnSave(wxCommandEvent &event)
virtual void x_Init(wxBoxSizer *mainsizer, int widget_width)
Provide virtual hook for subclasses to add their own controls below the main controls.
wxTextCtrl * m_FileRootName
Part of file name before image number.
void OnTilePreview(wxCommandEvent &event)
wxComboBox * m_ImageFormat
Image save format (jpeg, png...)
virtual bool TransferDataFromWindow()
float x_getAspectRatio() const
virtual ~CSaveImagesSetupDlg()
virtual bool TransferDataToWindow()
wxComboBox * m_NumberingFormat
How the numbers are included in filenames, e.g. img_{1..n} or img_x_y;.
CSaveImagesSetupDlg(CRef< CImage > img, IImageGrabber *img_saver, wxWindow *parent=NULL)
std::string GetFileRootName() const
static const float s_ImageAspectRatios[3]
Aspect ratios for image sizes (w/h)
void SetPartitions(const CVect2< int > &p)
Set number of desired image partitions.
void SetImageAspectRatio(float ar)
Set aspect ratio for image as a whole.
eCaptureResult PreviewImages(int tex_size, int ref_img_width, int ref_img_height, IImageGrabberProgress *p=NULL)
Grab images to update the on-screen image to approximate final output.
virtual eCaptureResult GrabImages(int tex_size, IImageGrabberProgress *p=NULL)
Grab the requested images.
void SetNumberingFormat(eImageNumberingFormat fmt)
Set the numbering format for sequential image names.
void SetPrintingGuidesEnabled(bool b)
Set to true to put cutting/printing guides on output images.
eCaptureResult GrabImage(int tex_size, CVect2< int > img_idx, IImageGrabberProgress *p=NULL)
Grab a single image for preview purposes.
void SetOutputInfo(const std::string &dir, const std::string &base_name, const std::string &img_format)
Set file output information.
void SetTileAspectRatio(float ar)
Set aspect ratio tiles captured.
IMPLEMENT_CLASS(CFloatingFrame, CFloatingFrameBaseClass) const static long kFloatFrameStyle
CFloatingFrame.
static const char * str(char *buf, int n)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const string kSaveImagesBaseKey("GBPlugins.SaveImagesDialog")
static void SetTitle(CRef< CSeq_entry > entry, string title)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4