void FormView::AlignObjectMenu(Bar& bar) { bar.Add(t_("Top "), THISBACK(AlignTopSelection)); bar.Add(t_("Left"), THISBACK(AlignLeftSelection)); bar.Add(t_("Right"), THISBACK(AlignRightSelection)); bar.Add(t_("Bottom "), THISBACK(AlignBottomSelection)); }
int PromptAbortRetryIgnore(const char *qtf, Callback HelpDlg, const char *help) { #ifdef PLATFORM_WIN32 MessageBeep(MB_ICONEXCLAMATION); #endif return Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, HelpDlg, false, t_("&Abort"), t_("&Retry"), t_("&Cancel"), help); }
void FormEdit::OpenFile() { UpdateChildZ(); FileSelector fs; fs.Type(t_("Form files"), "*.form"); fs.Type(t_("Form archives"), "*.fz"); fs.AllFilesType(); if (!fs.ExecuteOpen(t_("Open form..."))) return; Clear(); _File = ~fs; bool compression = false; if (Upp::GetFileName(_File).Find(".fz") >= 0) compression = true; _View.LoadAll(_File, compression); UpdateLayoutList(); UpdateChildZ(); Title((t_("Form Editor")) + String(" - ") + ::GetFileName(_File)); _Container.Set(_View, _View.GetPageRect().GetSize()); UpdateTools(); ProjectSaved(true); }
void DockBase::GroupDockMenu(Bar& bar, int command) { if(IsSideAllowed(DockableCtrl::DOCK_TOP)) bar.Add(t_("Top"), THISBACK3(GroupMenuAction, activegroup, (int) command, (int)DockableCtrl::DOCK_TOP)); if(IsSideAllowed(DockableCtrl::DOCK_LEFT)) bar.Add(t_("Left"), THISBACK3(GroupMenuAction, activegroup, (int) command, (int)DockableCtrl::DOCK_LEFT)); if(IsSideAllowed(DockableCtrl::DOCK_RIGHT)) bar.Add(t_("Right"), THISBACK3(GroupMenuAction, activegroup, (int) command, (int)DockableCtrl::DOCK_RIGHT)); if(IsSideAllowed(DockableCtrl::DOCK_BOTTOM)) bar.Add(t_("Bottom"), THISBACK3(GroupMenuAction, activegroup, (int) command, (int)DockableCtrl::DOCK_BOTTOM)); }
void FormEdit::SaveAsFile() { if (!_View.IsLayout()) return; UpdateChildZ(); FileSelector fs; fs.Type(t_("Form files (*.form)"), "*.form"); fs.Type(t_("Form archives (*.fz)"), "*.fz"); fs.AllFilesType(); if (!fs.ExecuteSaveAs(t_("Save form..."))) return; _File = ~fs; if (Upp::GetFileName(_File).Find('.') < 0) _File += ".form"; bool compression = false; if (Upp::GetFileName(_File).Find(".fz") >= 0) compression = true; _View.SaveAll(_File, compression); Title((t_("Form Editor")) + String(" - ") + ::GetFileName(_File)); ProjectSaved(true); }
DataListDefinitionDlg::DataListDefinitionDlg() { CtrlLayout(*this, t_("Name and Field definition")); edListName.SetData( theDefList.name ) ; labelInfo.SetQTF( t_( "[ $$0,0#00000000000000000000000000000000:Default]" "[s0;1 The 2 first fields are obligatory and they are not possible " "to be modified.&]" "[s0;1 You can create new fields to personalize its list.]" )) ; grid.Appending().Removing().EditCell().AddColumn(t_("field")).Edit(edCell) ; grid.AddRow(theDefList.fields.GetCount()) ; grid.GetRow(0).Editable(false) ; grid.GetRow(1).Editable(false) ; for (int i = 0; i < theDefList.fields.GetCount(); i++) grid.Set(i,0, theDefList.fields[i]) ; //grid.SetFixedRows(3) ; btCancel.WhenAction = Breaker(IDCANCEL) ; btSave.WhenAction = THISBACK(OnSave) ; }
DockCont::DockCont() { dragging = false; dockstate = STATE_NONE; base = NULL; waitsync = false; ignoreminsize = false; usersize.cx = usersize.cy = Null; BackPaint(); #ifdef PLATFORM_WIN32 ToolWindow(); #endif NoCenter().Sizeable(true).MaximizeBox(false).MinimizeBox(false); AddFrame(FieldFrame()); AddFrame(tabbar); AddFrame(handle); tabbar.AutoHideMin(1); tabbar.WhenCursor = THISBACK(TabSelected); tabbar.WhenDrag = THISBACK(TabDragged); tabbar.WhenContext = THISBACK(TabContext); tabbar.WhenClose = THISBACK(TabClosed); tabbar.WhenCloseAll = THISBACK(RefreshLayout); tabbar.SetBottom(); handle << close << autohide << windowpos; handle.WhenContext = THISBACK(WindowMenu); handle.WhenLeftDrag = THISBACK(MoveBegin); close.Tip(t_("Close")) <<= THISBACK(CloseAll); autohide.Tip(t_("Auto-Hide")) <<= THISBACK(AutoHide); windowpos.Tip(t_("Window Menu")) <<= THISBACK(WindowMenu); WhenClose = THISBACK(CloseAll); }
void FormEdit::CreateMenuBar(Bar& bar) { bar.Add(t_("File"), THISBACK(FileBar)); bar.Add(t_("Item"), THISBACK(ItemBar)); bar.Add(t_("Form"), THISBACK(FormBar)); bar.Add(t_("View"), THISBACK(ViewBar)); }
int PromptRetryCancel(const char *qtf) { BeepExclamation(); return Prompt(callback(LaunchWebBrowser), Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, true, t_("&Retry"), t_("Cancel"), NULL, 0, RetryButtonImage(), Null, Null); }
int PromptAbortRetryIgnore(const char *qtf) { BeepExclamation(); return Prompt(callback(LaunchWebBrowser), Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, false, t_("&Abort"), t_("&Retry"), t_("&Ignore"), 0, AbortButtonImage(), RetryButtonImage(), Null); }
int PromptYesNoCancel(const char *qtf) { BeepQuestion(); return Prompt(callback(LaunchWebBrowser), Ctrl::GetAppName(), CtrlImg::question(), qtf, true, t_("&Yes"), t_("&No"), t_("Cancel"), 0, YesButtonImage(), NoButtonImage(), Null); }
void MapEditor::OnLevelMapCalc(Level& level, int number) { if (level.GetMapBG().IsEmpty()) { Exclamation(NFormat(t_("Please, select the image for level: %s"), level.GetName())); return; } String fp = AppendFileName( AppendFileName( GetFileDirectory(GetExeFilePath()), "Maps"), level.GetMapBG()); if (!FileExists(fp)) { Exclamation(NFormat(t_("Image file not exist: %s"), fp)); return; } String name = level.GetName(); double zx = level.GetZoomDX(); Size pz = level.GetPageSize(); Size sz = level.GetCellSize(); FileIn in(fp); One<StreamRaster> r = StreamRaster::OpenAny(in); if (!r) { Exclamation(NFormat(t_("Error while loading image file: %s"), fp)); return; } Image img = r->GetImage(); Calculate(sz.cx, sz.cy, pz.cx, pz.cy, zx, NFormat("%s-%d", _map.GetName(), number + 1), img); }
void GrabScreen::ButSnap_Push() { /* program->Minimize(); TopWindow win; Button b; b.SetLabel("CLOSE"); b <<= win.Breaker(); StaticImage desktop; desktop.Set(Snap_Desktop()); win.Add(desktop.SizePos()); win.Add(b.LeftPos(10, 100).TopPos(10, 30)); win.FullScreen().Run(); program->Overlap(); */ String fileName = ~editFileNameSnap; FileDelete(fileName); String ext = GetFileExt(fileName); if (ext == ".png") { PNGEncoder encoder; if (!encoder.SaveFile(fileName, canvasImage)) Exclamation(Format(t_("Impossible to save %s"), fileName)); } else if (ext == ".jpg") { JPGEncoder encoder(90); if (!encoder.SaveFile(fileName, canvasImage)) Exclamation(Format(t_("Impossible to save %s"), fileName)); } else Exclamation(Format(t_("File format \"%s\" not found"), ext)); }
void RichEdit::SetStyle() { if(!IsSelection()) { NextUndo(); WithSetStyleLayout<TopWindow> d; CtrlLayoutOKCancel(d, t_("Set style")); d.newstyle <<= d.Breaker(IDYES); d.style.AddKey(); d.style.AddColumn(); d.style.NoHeader().NoGrid(); for(int i = 0; i < text.GetStyleCount(); i++) d.style.Add(text.GetStyleId(i), text.GetStyle(i).name); d.style.Sort(1, CompareStyle); int q = d.style.Find(RichStyle::GetDefaultId()); if(q >= 0) d.style.SetDisplay(q, 0, Single<DisplayDefault>()); d.style.FindSetCursor(formatinfo.styleid); RichStyle cs; cs.format = formatinfo; cs.format.sscript = 0; cs.format.link.Clear(); cs.format.indexentry.Clear(); cs.format.language = LNG_ENGLISH; cs.format.label.Clear(); Uuid id; switch(d.Run()) { case IDCANCEL: return; case IDOK: if(d.style.IsCursor()) { id = d.style.GetKey(); const RichStyle& st = text.GetStyle(id); cs.name = st.name; cs.next = st.next; SaveStyleUndo(id); break; } return; case IDYES: String newname; if(EditText(newname, Format(t_("New style no. %d"), text.GetStyleCount()), "Name", CharFilterAscii128)) { cs.name = newname; id = Uuid::Create(); cs.next = id; SaveStylesUndo(); break; } return; } text.SetStyle(id, cs); ReadStyles(); formatinfo.styleid = id; SaveFormat(GetCursor(), 0); text.ReStyle(GetCursor(), id); Finish(); } }
Value ConvertDate::Scan(const Value& text) const { Value v = UPP::Scan(DATE_V, text, defaultval); if(IsError(v)) return v; if(IsNull(v)) return notnull ? NotNullError() : v; Date m = v; if(m >= minval && m <= maxval) return v; return ErrorValue(t_("Date must be between ") + UPP::Format(minval) + t_("range\v and ") + UPP::Format(maxval) + "."); }
void MainDlg::OnFile() { FileSel dlg; dlg.ReadOnlyOption(); dlg.ExecuteOpen( t_("Test") ); dlg.ExecuteSaveAs( t_("Test") ); dlg.ExecuteSelectDir( t_("Test") ); }
void Puzzle::GameMenu(Bar& bar) { bar.Add(t_("New game"), THISBACK(New)); bar.Add(t_("Setup.."), THISBACK(Setup)); bar.Add(t_("Best scores.."), THISBACK(Scores)); bar.Separator(); bar.Add(t_("Exit"), Breaker()); }
Test1::Test1() { Title("Test"); Add(lbl1.SetText(t_("Hello")).TopPos(2,22).HSizePos(22,22)); Add(lbl2.SetText(t_("World")).VSizePos(24,24).HSizePos(2,2)); Add(lbl3.SetText(t_("Save")).BottomPos(2,22).HSizePos(22,22)); Sizeable().Zoomable(); }
void FormEdit::FormBar(Bar& bar) { bar.Add(t_("Change form settings..."), FormViewImg::LayoutProperties(), THISBACK(OpenLayoutProperties)) .Enable(_View.IsLayout()) .Tip(t_("Change form settings...")); bar.Add(t_("Preview"), FormViewImg::Layout(), THISBACK(TestLayout)) .Enable(_View.IsLayout()) .Tip(t_("Preview")); }
void FormEdit::NewFile() { Clear(); Title(t_("Form Editor") + String(" - ") + String(t_("New file"))); ProjectSaved(false); _View.New(); _Container.Set(_View, _View.GetPageRect().GetSize()); Refresh(); }
void StyleManager::Menu(Bar& bar) { bar.Add(t_("Create new style.."), THISBACK(Create)) .Key(K_INSERT); bar.Add(t_("Remove style"), THISBACK(Remove)) .Key(K_DELETE); bar.Add(t_("Rename.."), callback(&list, &ArrayCtrl::DoEdit)) .Key(K_CTRL_ENTER); }
void InvoiceList::formatHeader(StringBuffer &buf) { buf.Cat("{{1:1~ "); buf.Cat("[*A3 " + AsString(t_("Invoice list")) + "] :: [*A3 ]:: "); buf.Cat("[A1 " + AsString(t_("Date from:")) + "-|" + AsString(from)); buf.Cat("&" + AsString(t_("Date to:")) + "-|" + AsString(to)); buf.Cat("]:: "); buf.Cat("}}"); }
bool FileSelector::Execute(bool open, const char *title) { Ctrl::ReleaseCtrlCapture(); if(!title) title = open ? t_("Open") : t_("Save as"); Ctrl *w = Ctrl::GetActiveWindow(); GtkWidget *fc = gtk_file_chooser_dialog_new(title, w ? w->gtk() : NULL, open ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, open ? GTK_STOCK_OPEN : GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(fc), confirm); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(fc), true); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(fc), multi); gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(fc), hidden); if(IsFullPath(ipath)) { FindFile ff(ipath); if(ff) if(ff.IsFolder()) gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc), ipath); else gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(fc), ipath); else { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc), GetFileFolder(ipath)); gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), GetFileName(ipath)); } } else gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), ipath); ipath.Clear(); for(int i = 0; i < type.GetCount(); i++) { GtkFileFilter *filter = gtk_file_filter_new(); gtk_file_filter_set_name(filter, type[i].a); gtk_file_filter_add_pattern(filter, type[i].b); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fc), filter); if(i == activetype) gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(fc), filter); } bool ret = false; path.Clear(); if(gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_OK) { GSList *list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(fc)); if(list) { GSList *l; for(l = list; l; l = l->next) { path.Add((const char *)l->data); g_free(l->data); } g_slist_free (list); } ret = true; } gtk_widget_destroy(fc); return ret; }
// item selection callback void XMLBarEditor::itemSelCb() { // get selected node int i = barTree.GetCursor(); // if none, just disable input fields and return if(i < 0) { itemPane.Disable(); return; } // enable input pane itemPane.Enable(); // enable label and tooltip fields itemPane.label.Enable(); // disable command field, it'll be filled // by command bar anyways itemPane.cmdId.Disable(); // if not the root, treat as an item // otherwise allow just to edit bar name if(i > 0) { itemPane.icon.Enable(); itemPane.tooltip.Enable(); // fetch node data XMLToolBarItem const &item = ValueTo<XMLToolBarItem>(barTree.Get(i)); bool hasChilds = barTree.GetChildCount(i); // fill fields if(hasChilds) itemPane.cmdId.Clear(); else itemPane.cmdId = item.GetId(); itemPane.labelName = t_("Label :"); itemPane.label = item.GetLabel(); itemPane.tooltip = item.GetTooltip(); itemPane.icon.SetImage(item.GetIcon()); curIcon = item.GetIcon(); } else { itemPane.icon.Disable(); itemPane.tooltip.Disable(); itemPane.cmdId.Clear(); itemPane.labelName = t_("Bar name :"); itemPane.label = String(barTree.GetValue(0)); itemPane.tooltip.Clear(); itemPane.icon.SetImage(Null); curIcon = Null; } }
void GrabScreen::Init(GrabYourScreen &_program) { program = &_program; editFileNameGrab <<= AppendFileName(GetDesktopFolder(), "ScreenGrab.avi"); editFileNameGrab.Type(t_("Video file"), ".avi"); editTime <<= 5; editFrameRate <<= 1; opGrabMouse <<= true; swGrabMode.Add("Desktop"); swGrabMode.Add("Window"); #if defined(PLATFORM_WIN32) swGrabMode.Add("Rectangle"); #endif swGrabMode.MinCaseHeight(20); swGrabMode.SetData(0); swGrabMode.WhenAction = THISBACK(SwGrabMode_Action); SwGrabMode_Action(); #if defined(PLATFORM_WIN32) butGrab.WhenPush = THISBACK(ButGrab_Push); #else butGrab.Enable(false); editFileNameGrab.Enable(false); editTime.Enable(false); editFrameRate.Enable(false); opGrabMouse.Enable(false); editLeft.Hide(); editTop.Hide(); editWidth.Hide(); editHeight.Hide(); left.Hide(); top.Hide(); width.Hide(); height.Hide(); #endif editLeft <<= 100; editWidth <<= 1000; editTop <<= 100; editHeight <<= 900; String extension; editFileNameSnap <<= AppendFileName(GetDesktopFolder(), "ScreenSnap.jpg"); editFileNameSnap.Type(t_("Image file"), ".jpg"); butSnap.WhenPush = THISBACK(ButSnap_Push); Array<int64> hWnd, processId; Array<String> name, fileName, caption; GetWindowsList(hWnd, processId, name, fileName, caption, false); Sort(caption); for (int i = 0; i < caption.GetCount(); ++i) { if (!Trim(caption[i]).IsEmpty()) editWindowTitle.Add(caption[i]); } editWindowTitle.SetData(editWindowTitle.GetValue(0)); SetTimeCallback(-1000, THISBACK(Timer)); }
SqlObjectTree::SqlObjectTree(SqlSession& sess) : session(sess) { Title(t_("SQL object tree")); Sizeable().MaximizeBox(); Add(schema.SizePos()); schema.WhenOpen = THISBACK(Open); schema.SetRoot(CtrlImg::Computer(), Item(OBJ_SCHEMA), t_("Schemas")); schema.WhenBar = THISBACK(ToolLocal); }
// bar list context menu void XMLBarsEditor::barContextCb(Bar &bar) { // get current selection bar.Add(t_("Add new bar"), THISBACK(barContextAddCb)); int i = barListPane.barList.GetCursor(); if(i < 0) return; String barName = barListPane.barList.Get(i); bar.Add(Format(t_("Remove bar '%s'"), barName), THISBACK(barContextRemoveCb)); }
void InvoiceFormatter::formatHeader(StringBuffer &buf, InvoiceData &invoice) { buf.Cat("{{1:1~ "); buf.Cat("[*A3 " + AsString(t_("Invoice")) + "] :: [*A3 " + AsString(t_("invoice num:")) + " " + AsString(invoice.inv_id) + "]:: "); buf.Cat("[A1 " + AsString(t_("Create date:")) + "-|-|-|" + AsString(invoice.create_date)); if (lang != LANG_CZ) { buf.Cat("&" + AsString(t_("Delivery date:")) + "-|-|" + AsString(invoice.delivery_date) + "&"); buf.Cat(AsString(t_("Payment date:")) + "-|-|-|" + AsString(invoice.payment_date) ); } buf.Cat("]:: "); // no payment type in CZ if (lang != LANG_CZ) { String type; switch (invoice.payment_type) { case iptCurrency: type = t_("currency"); break; case iptBankTransfer: type = t_("bank transfer"); break; default: type = t_("currency"); } buf.Cat("[A1 " + AsString(t_("Payment type:")) + "-|-|" + type + "]&"); } buf.Cat("}}"); }
String GetKeyDesc(dword key) { String desc; // key &= 0xFFFF; if(key == 0) return desc; if(key & K_CTRL) desc << t_("key\vCtrl+"); if(key & K_ALT) desc << t_("key\vAlt+"); if(key & K_SHIFT) desc << t_("key\vShift+"); if(key & K_KEYUP) desc << t_("key\vUP "); key &= ~(K_CTRL | K_ALT | K_SHIFT | K_KEYUP); if(key < K_DELTA && key > 32 && key != K_DELETE) return desc + ToUtf8((wchar)key); if(key >= K_NUMPAD0 && key <= K_NUMPAD9) desc << "Num " << (char)(key - K_NUMPAD0 + '0'); else if(key >= K_0 && key <= K_9) desc << (char)('0' + key - K_0); else if(key >= K_A && key <= K_Z) desc << (char)('A' + key - K_A); else if(key >= K_F1 && key <= K_F12) desc << Format("F%d", (int)key - K_F1 + 1); else { static struct { dword key; const char *name; } nkey[] = { { K_TAB, tt_("key\vTab") }, { K_SPACE, tt_("key\vSpace") }, { K_RETURN, tt_("key\vEnter") }, { K_BACKSPACE, tt_("key\vBackspace") }, { K_CAPSLOCK, tt_("key\vCaps Lock") }, { K_ESCAPE, tt_("key\vEsc") }, { K_PAGEUP, tt_("key\vPage Up") }, { K_PAGEDOWN, tt_("key\vPage Down") }, { K_END, tt_("key\vEnd") }, { K_HOME, tt_("key\vHome") }, { K_LEFT, tt_("key\vLeft") }, { K_UP, tt_("key\vUp") }, { K_RIGHT, tt_("key\vRight") }, { K_DOWN, tt_("key\vDown") }, { K_INSERT, tt_("key\vInsert") }, { K_DELETE, tt_("key\vDelete") },{ K_BREAK, tt_("key\vBreak") }, { K_MULTIPLY, tt_("key\vNum[*]") }, { K_ADD, tt_("key\vNum[+]") }, { K_SUBTRACT, tt_("key\vNum[-]") }, { K_DIVIDE, tt_("key\vNum[/]") }, { K_ALT_KEY, tt_("key\vAlt") }, { K_SHIFT_KEY, tt_("key\vShift") }, { K_CTRL_KEY, tt_("key\vCtrl") }, { K_PLUS, tt_("key\v[+]") }, { K_MINUS, tt_("key\v[-]") }, { K_COMMA, tt_("key\v[,]") }, { K_PERIOD, tt_("key\v[.]") }, { K_SEMICOLON, tt_("key\v[;]") }, { K_SLASH, tt_("key\v[/]") }, { K_GRAVE, tt_("key\v[`]") }, { K_LBRACKET, tt_("key\v[[]") }, { K_BACKSLASH, tt_("key\v[\\]") }, { K_RBRACKET, tt_("key\v[]]") }, { K_QUOTEDBL, tt_("key\v[']") }, { 0, NULL } }; for(int i = 0; nkey[i].key; i++) if(nkey[i].key == key) { desc << GetLngString(nkey[i].name); return desc; } desc << Format("%04x", (int)key); } return desc; }
void InvoiceFormatter::formatBillHeader(StringBuffer &buf, InvoiceData &invoice, bool isStandelone) { if (isStandelone) buf.Cat("[*A3 " + AsString(t_("Receipt")) + "&]"); else buf.Cat("[*A2 " + AsString(t_("Receipt")) + "&]"); buf.Cat("[A1 " + AsString(t_("Payment of the invoice:")) + " "); buf.Cat(AsString(invoice.inv_id)); buf.Cat("&&" + AsString(t_("Payed date:")) + " "); buf.Cat(AsString(invoice.payed_date)); buf.Cat("] "); }