void EyedropperCommand::onExecute(Context* context) { Widget* widget = gui::Manager::getDefault()->getMouse(); if (!widget || widget->type != editor_type()) return; Editor* editor = static_cast<Editor*>(widget); Sprite* sprite = editor->getSprite(); if (!sprite) return; // pixel position to get int x, y; editor->screenToEditor(jmouse_x(0), jmouse_y(0), &x, &y); // get the color from the image Color color = Color::fromImage(sprite->getPixelFormat(), sprite->getPixel(x, y)); // TODO replace the color in the "context", not directly from the color-bar // set the color of the color-bar if (m_background) app_get_colorbar()->setBgColor(color); else app_get_colorbar()->setFgColor(color); }
Command* PinView::InterpGraphicCompManip (Manipulator* m) { DragManip* dm = (DragManip*) m; Editor* ed = dm->GetViewer()->GetEditor(); BrushVar* brVar = (BrushVar*) ed->GetState("Brush"); SlidingPin* sp = (SlidingPin*) dm->GetRubberband(); Transformer* rel = dm->GetTransformer(); Coord px, py, dum; float dx, dy; PinGraphic* pinGraphic; sp->GetCurrent(px, py, dum, dum); if (rel != nil) { GetOffset(rel, px, py, dx, dy); rel = new Transformer; rel->Translate(dx, dy); } Graphic* pg = GetGraphicComp()->GetGraphic(); pinGraphic = new PinGraphic(px, py, pg); if (brVar != nil) pinGraphic->SetBrush(brVar->GetBrush()); pinGraphic->SetTransformer(rel); Unref(rel); return new PasteCmd(ed, new Clipboard(NewSubject(pinGraphic))); }
/** * @brief Do NOT directly connect to Editor signals within this method, * or they'll remain attached to this EditorTabWidget whenever the * tab gets moved to another container. Use connectEditorSignals() * and disconnectEditorSignals() methods instead. */ int EditorTabWidget::rawAddEditorTab(const bool setFocus, const QString &title, EditorTabWidget *source, const int sourceTabIndex) { #ifdef QT_DEBUG QElapsedTimer __aet_timer; __aet_timer.start(); #endif bool create = (source == 0); this->setUpdatesEnabled(false); Editor *editor; QString oldText; QIcon oldIcon; QString oldTooltip; if (create) { editor = Editor::getNewEditor(this); } else { editor = source->editor(sourceTabIndex); oldText = source->tabText(sourceTabIndex); oldIcon = source->tabIcon(sourceTabIndex); oldTooltip = source->tabToolTip(sourceTabIndex); } int index = this->addTab(editor, create ? title : oldText); if (!create) { source->disconnectEditorSignals(editor); } this->connectEditorSignals(editor); if(setFocus) { this->setCurrentIndex(index); editor->setFocus(); } if (create) { this->setSavedIcon(index, true); } else { this->setTabIcon(index, oldIcon); this->setTabToolTip(index, oldTooltip); } // Common setup editor->setZoomFactor(m_zoomFactor); this->setUpdatesEnabled(true); emit editorAdded(index); #ifdef QT_DEBUG qint64 __aet_elapsed = __aet_timer.nsecsElapsed(); qDebug() << QString("Tab opened in " + QString::number(__aet_elapsed / 1000 / 1000) + "msec").toStdString().c_str(); #endif return index; }
void PasteTextCommand::onExecute(Context* ctx) { Editor* editor = current_editor; if (editor == NULL) return; Preferences& pref = Preferences::instance(); PasteTextWindow window(pref.textTool.fontFace(), pref.textTool.fontSize(), pref.textTool.antialias(), pref.colorBar.fgColor()); window.userText()->setText(last_text_used); window.openWindowInForeground(); if (window.closer() != window.ok()) return; last_text_used = window.userText()->text(); bool antialias = window.antialias()->isSelected(); std::string faceName = window.faceValue(); int size = window.sizeValue(); size = MID(1, size, 999); pref.textTool.fontFace(faceName); pref.textTool.fontSize(size); pref.textTool.antialias(antialias); try { std::string text = window.userText()->text(); app::Color appColor = window.fontColor()->getColor(); doc::color_t color = doc::rgba(appColor.getRed(), appColor.getGreen(), appColor.getBlue(), appColor.getAlpha()); doc::ImageRef image(render_text(faceName, size, text, color, antialias)); if (image) { Sprite* sprite = editor->sprite(); if (image->pixelFormat() != sprite->pixelFormat()) { RgbMap* rgbmap = sprite->rgbMap(editor->frame()); image.reset( render::convert_pixel_format( image.get(), NULL, sprite->pixelFormat(), render::DitheringAlgorithm::None, render::DitheringMatrix(), rgbmap, sprite->palette(editor->frame()), false, 0)); } editor->pasteImage(image.get()); } } catch (const std::exception& ex) { ui::Alert::show(PACKAGE "<<%s" "||&OK", ex.what()); } }
void NewViewCmd::Execute () { Editor* ed = GetEditor(); Editor* newEd = new IdrawEditor(GetGraphicComp()); *newEd->GetState("ModifStatusVar") = *ed->GetState("ModifStatusVar"); unidraw->Open(newEd); }
void AboutCmd::Execute () { Editor* ed = GetEditor(); AcknowledgeDialog dialog(VERSION); ed->InsertDialog(&dialog); dialog.Acknowledge(); ed->RemoveDialog(&dialog); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyle( new QPlastiqueStyle()); Editor w; w.show(); return a.exec(); }
void EditorTab::onEditorTextChanged(void) { int index = currentIndex(); Editor * editor = (Editor *)widget(index); setTabText(index, "*" + QFileInfo(editor->GetFileName()).fileName()); emit codeChanged(); }
void LoadMessage::process() { Editor* pEditor = dynamic_cast<Editor*>(gpGame); if (pEditor != NULL) { pEditor->load(); } }
void EditorTab::ConfigureAllTabs(void) { for (int i=0; i < count(); i++) { if (tabType(i) == MM::codeTab) { Editor * editor = (Editor *)widget(i); editor->Configure(); } } }
void editor::DefineFloorGroup( char const* name, char const* descr, int nentries, char ** entries ) { Editor *ed = Editor::get_instance(); vector<string> entryvec(entries, entries+nentries); ObjectGroup group(name, descr, entryvec); ed->add_floor_group (group); }
void Keyboard(unsigned char key, int mx, int my) { mouse.posX = mx; mouse.posY = my; if ( key == 'e' ) { editor.ToggleEditMode(); } else if(editor.editMode) { editor.Keyboard(key, mx, my); } }
void EditorView::onScrollChange() { View::onScrollChange(); Editor* editor = this->editor(); ASSERT(editor != NULL); if (editor) editor->notifyScrollChanged(); }
int main(int argc,char** argv) { QApplication app(argc,argv); Editor editor; editor.resize(700,500); editor.show(); return app.exec(); }
int main(){ Editor* editor = new Editor(); editor->run(); delete editor; return 0; }
int main(int argc, char* argv[]) { Editor* editor = Editor::getEditor(); if (editor!=0) editor->run(); return 0; }
CEVENT(CMDBoard, _SavePost) { Editor* ed = ((EditorSavedArgs*)args)->editor; BoardPost* post = (BoardPost*)ed->GetArg(); std::vector<std::string>* lines; lines = ed->GetLines(); post->SetMessage(Explode(*lines, "\n")); }
void Editor::newDoc() { if ( !spawnedEditors ) spawnedEditors = new EditorList; Editor *ed = new Editor; spawnedEditors->append( ed ); // add to list of spawned eds ed->resize( 400, 400 ); ed->show(); }
static void UpdateCompNameVars () { Iterator i; for (unidraw->First(i); !unidraw->Done(i); unidraw->Next(i)) { Editor* ed = unidraw->GetEditor(i); CompNameVar* compNameVar = (CompNameVar*) ed->GetState("CompNameVar"); if (compNameVar != nil) compNameVar->UpdateName(); } }
void editor::DefineStoneGroup( const char *name, const char *descr, int nentries, char **entries ) { Editor *ed = Editor::get_instance(); vector<string> entryvec( entries, entries+nentries ); ObjectGroup group( name, descr, entryvec ); ed->add_stone_group( group ); }
void MainWindow::open() { Editor *editor = Editor::open(this); if (editor){ addEditor(editor); AlnFileName = editor->getFileName(); editor->setLineWrapMode(QTextEdit::NoWrap); }//if }
int main(int argc, char *argv[]) { QApplication app(argc, argv); Editor editorWindow; editorWindow.show(); return app.exec(); }
void SetAStyle(Editor& ed, int style, Colour fore, Colour back=0xFFFFFFFF, int size=-1, const char *face=0) { ed.Command(SCI_STYLESETFORE, style, fore); ed.Command(SCI_STYLESETBACK, style, back); if (size >= 1) ed.Command(SCI_STYLESETSIZE, style, size); if (face) ed.Command(SCI_STYLESETFONT, style, reinterpret_cast<sptr_t>(face)); }
Manipulator* TextOvView::CreateManipulator ( Viewer* v, Event& e, Transformer* rel, Tool* tool ) { Manipulator* m = nil; Editor* ed = v->GetEditor(); int tabWidth = Math::round(.5*ivinch); if (tool->IsA(GRAPHIC_COMP_TOOL)) { FontVar* fontVar = (FontVar*) ed->GetState("FontVar"); ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar"); PSFont* font = (fontVar == nil) ? psstdfont : fontVar->GetFont(); PSColor* fg = (colVar == nil) ? psblack : colVar->GetFgColor(); int lineHt = font->GetLineHt(); Painter* painter = new Painter; painter->FillBg(false); painter->SetFont(font); painter->SetColors(fg, nil); Orientation o = v->GetOrientation(); if (o!=Rotated) painter->SetTransformer(rel); else { rel = new Transformer(rel); rel->Rotate(90.0); painter->SetTransformer(rel); Unref(rel); } m = new TextManip(v, painter, lineHt, tabWidth, tool); } else if (tool->IsA(RESHAPE_TOOL)) { TextGraphic* textgr = (TextGraphic*) GetGraphic(); Painter* painter = new Painter; int lineHt = textgr->GetLineHeight(); Coord xpos, ypos; rel = new Transformer; const char* text = textgr->GetOriginal(); int size = strlen(text); textgr->TotalTransformation(*rel); rel->Transform(0, 0, xpos, ypos); painter->FillBg(false); painter->SetFont(textgr->GetFont()); painter->SetColors(textgr->GetFgColor(), nil); painter->SetTransformer(rel); Unref(rel); m = new TextManip( v, text, size, xpos, ypos, painter, lineHt, tabWidth, tool ); } else { m = OverlayView::CreateManipulator(v, e, rel, tool); } return m; }
ULong View::zoom (ULong code) { POINT dOrg; switch (code) { case WM_LBUTTONDOWN: // Zoom In _Editor.ClearWindow (); dOrg.x = ((cRect.right - cRect.left) / 2) - _Editor.MousePos.x; dOrg.y = ((cRect.bottom - cRect.top) / 2) - _Editor.MousePos.y; dOrg.x += Org.x - _Editor.MousePos.x; dOrg.y += Org.y - _Editor.MousePos.y; Scalex /= 2; Scaley /= 2; Org.x += dOrg.x; Org.y += dOrg.y; InvalidateRect (hWnd, NULL, TRUE); return TRUE; case WM_RBUTTONDOWN: // Zoom Out _Editor.ClearWindow (); dOrg.x = ((cRect.right - cRect.left) / 2) - _Editor.MousePos.x; dOrg.y = ((cRect.bottom - cRect.top) / 2) - _Editor.MousePos.y; dOrg.x -= (Org.x - _Editor.MousePos.x) / 2; dOrg.y -= (Org.y - _Editor.MousePos.y) / 2; Scalex *= 2; Scaley *= 2; Org.x += dOrg.x; Org.y += dOrg.y; InvalidateRect (hWnd, NULL, TRUE); return TRUE; } return FALSE; }
void GUI::SaveCurrentMap(FileName filename, bool showdialog) { Editor* editor = GetCurrentEditor(); if(editor) editor->saveMap(filename, showdialog); UpdateTitle(); root->UpdateMenubar(); root->Refresh(); }
int main(int argc, char* argv[]) { PHYSFS_init(argv[0]); Editor* editor = Editor::getEditor(); if (editor!=0) editor->run(); return 0; }
void PreviewEditorWindow::onPopupSpeed() { Editor* miniEditor = (m_docView ? m_docView->editor(): nullptr); if (!miniEditor || !miniEditor->document()) return; miniEditor->showAnimationSpeedMultiplierPopup( Preferences::instance().preview.playOnce, false); m_aniSpeed = miniEditor->getAnimationSpeedMultiplier(); }
void EditorManager::nameChanged(EventArgs& args) { EditorEventArgs eea = dynamic_cast<EditorEventArgs&>(args); Editor* editor = eea.getEditor(); if(mEditorIndexMap.find(editor) != mEditorIndexMap.end()) { int index = mEditorIndexMap[editor]; mEditorNotebook->SetPageText(index, editor->getName()); } }
int main( int argc, char* args[] ) { Editor *game; game = new Editor(SCREEN_HEIGHT, SCREEN_WIDTH, false); game->Run(); delete game; return 0; }