void TilesetGroupEditor::on_RemoveTileset_clicked() { if(ui->tilesetList->selectedItems().size() == 0) return; tilesets.removeAt(ui->tilesetList->row(ui->tilesetList->selectedItems()[0])); redrawAll(); }
KiviatView::KiviatView( QWidget * p, int _axisCount) : QGraphicsView(p), axisCount(_axisCount) { //Connect Scene to View setScene(&scene); //Turn of scrollbars ( the kiviat-diagram is resized, see also resizeEvent) setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //Init Properties with default values prop_markerCount=5; prop_activeAlpha = 220; prop_inactiveAlpha= 80; prop_cornerPointRadius=10; prop_angleOffset=0; curDataItem=-1; labelFont.setPointSize(labelFont.pointSize()*1.5); setRenderHint(QPainter::Antialiasing,true); redrawAll(); };
ReflowParameters ControlPage::run() { uint32_t start; // draw the full GUI redrawAll(); // go into a keypress/timeout event loop start=MillisecondTimer::millis(); for(;;) { // each second, sample the temperature and display it if(MillisecondTimer::hasTimedOut(start,1000)) { drawTemperature(); start=MillisecondTimer::millis(); } if(_buttonPressed) { // interrupt handler has indicated that a button is down switch(_buttonId) { case ButtonIdentifier::LEFT: handleLeft(); break; case ButtonIdentifier::RIGHT: handleRight(); break; case ButtonIdentifier::OK: if(handleOk()) { // user has clicked reflow, return the parameters we gathered on this page ReflowParameters params; params.P=_p.getValue(); params.I=_i.getValue(); params.D=_d.getValue(); params.Leaded=_leadedChecked; return params; } break; } // ready for the next press _buttonPressed=false; } } }
void ToolFrame::setSize(Point size_,bool buf_dirty) { if( ( size_!=Null && size!=size_ ) || buf_dirty ) { size=size_; redrawAll(true); } }
// ****************************************** void Editor::actionLibraryEditPatch(unsigned int n) { // ****************************************** #ifdef DEBUG qDebug() << "Editor::actionLibraryEdit(" << n << ")"; #endif midiout.programChange(channel,n); patch = lib.getPatch(n); emit redrawAll(); }
// ****************************************** void Editor::actionRandomizePatch() { // ****************************************** #ifdef DEBUG qDebug() << "Editor::actionRandomizePatch()"; #endif patch.randomizePatch(); emit redrawAll(); emit displayStatusbar("Patch randomized."); }
// ****************************************** void Editor::actionResetPatch() { // ****************************************** #ifdef DEBUG qDebug() << "Editor::actionResetPatch()"; #endif patch.resetPatch(); emit redrawAll(); emit displayStatusbar("Patch reset."); }
void ToolFrame::paintDone(unsigned) { if( delay_draw ) { delay_draw=false; redrawAll(); } }
// ****************************************** void Editor::actionLoadPatch(QString filename) { // ****************************************** bool status = patch.loadFromDisk(filename); #ifdef DEBUG qDebug() << "Editor::actionLoadPatch(" << filename << "):" << status; #endif if (status) emit displayStatusbar("Patch loaded from disk."); else emit displayStatusbar("Could not load patch."); emit redrawAll(); }
void TilesetGroupEditor::movedTileset(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) { Q_UNUSED(sourceParent) Q_UNUSED(sourceEnd) Q_UNUSED(destinationParent) qDebug() << "Tilesets moved"; tilesets.swap(sourceStart, destinationRow); redrawAll(); ui->tilesetList->setCurrentRow(destinationRow); }
/* void edTerrainNode::onSelect(osg::Geode *geom) { for (unsigned int i=0; i<visuals.size(); i++) if (visuals[i]->getNumParents()>0) { osg::Group *gr= visuals[i]->getParent(0); gr->removeChild(visuals[i].get()); gr->addChild(selectedVisuals[i].get()); } } void edTerrainNode::onDeselect() { for (unsigned int i=0; i<selectedVisuals.size(); i++) if (selectedVisuals[i]->getNumParents()>0) { osg::Group *gr= selectedVisuals[i]->getParent(0); gr->removeChild(selectedVisuals[i].get()); gr->addChild(visuals[i].get()); } } */ void edTerrainNode::applyCulture(const char *cultureFile) { Editor::instance()->disableRedraws(); cultures.push_back(new Culture()); cultures.back()->load(cultureFile); for (unsigned int i=0; i<selectedVisuals.size(); i++) { cultures.back()->apply(selectedVisuals[i]->getParent(0)->asTransform()->asMatrixTransform(),dynamic_cast<osg::Geode*>(selectedVisuals[i].get())); } Editor::instance()->enableRedraws(); redrawAll(); }
void edTerrainNode::setMaterialName(const char* name) { printf("setMaterialName %s\n", name); _materialName = name; // TerrainMaterial* mat = Editor::instance()->getOrCreateMaterial(name); material = Editor::instance()->getOrCreateMaterial(name); Editor::instance()->selectMaterial(material.get()); redrawAll(); }
void TilesetGroupEditor::on_tilesetDown_clicked() { if(ui->tilesetList->selectedItems().size() == 0) return; int i = ui->tilesetList->row(ui->tilesetList->selectedItems()[0]); if(i + 1 < tilesets.size()) { tilesets.swap(i, i + 1); redrawAll(); ui->tilesetList->setCurrentRow(i + 1); } }
void TilesetGroupEditor::on_Open_clicked() { QString f = QFileDialog::getOpenFileName(this, tr("Select Tileset Group"), m_configs->config_dir + "group_tilesets/", QString("PGE Tileset Group (*.tsgrp.ini)")); if(f.isEmpty()) return; if(!f.startsWith(m_configs->config_dir + "group_tilesets/")) { QFile file(f); QFile tar(f = (m_configs->config_dir + "group_tilesets/" + f.section("/", -1, -1))); if(tar.exists()) { QMessageBox msgBox; msgBox.setText(tr("There is already a file called '%1'!\nImport anyway and overwrite?").arg(tar.fileName())); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); if(msgBox.exec() == QMessageBox::Ok) tar.remove(); else return; } file.copy(f); } SimpleTilesetGroup t; if(OpenSimpleTilesetGroup(f, t)) { tilesets.clear(); ui->tilesetGroupName->setText(t.groupName); ui->category->setText(t.groupCat); for(QString &tarName : t.tilesets) { QString rootTilesetDir = m_configs->config_dir + "tilesets/"; SimpleTileset st; if(tileset::OpenSimpleTileset(rootTilesetDir + tarName, st)) tilesets << qMakePair<QString, SimpleTileset>(tarName, st); } redrawAll(); } else { QMessageBox::warning(this, tr("Failed to load tileset group!"), tr("Failed to load tileset group!\nData may be corrupted!")); } }
void TilesetGroupEditor::on_addTileset_clicked() { QString f = QFileDialog::getOpenFileName(this, tr("Select Tileset"), m_configs->config_dir + "tilesets/", QString("PGE Tileset (*.ini)")); if(f.isEmpty()) return; if(!f.startsWith(m_configs->config_dir + "tilesets/")) { QFile file(f); QFile tar(f = (m_configs->config_dir + "tilesets/" + f.section("/", -1, -1))); if(tar.exists()) { QMessageBox msgBox; msgBox.setText(tr("There is already a file called '%1'!\nImport anyway and overwrite?").arg(tar.fileName())); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); if(msgBox.exec() == QMessageBox::Ok) tar.remove(); else return; } file.copy(f); } SimpleTileset t; if(tileset::OpenSimpleTileset(f, t)) { QPair<QString, SimpleTileset> i; i.first = f.section("/", -1, -1); i.second = t; tilesets << i; redrawAll(); } else { QMessageBox::warning(this, tr("Failed to load tileset!"), tr("Failed to load tileset!\nData may be corrupted!")); } }
// ****************************************** void Editor::actionSysexRecieved(unsigned int size, unsigned char* message) { // ****************************************** #ifdef DEBUG qDebug() << "Editor::actionSysexRecieved(" << size << ",...)"; #endif bool status; bool libraryMode = lib.isRecieving(); if (7<size && message[6]==1 && message[7]==0) { if (libraryMode) { status = lib.parseFullSysex(message,size); if (lib.isRecieving()) { midiout.programChange(channel,lib.getNumPatches()); actionFetchPatch(); } else { emit redrawPatches(); } } else { status = patch.parseFullSysex(message,size); } if (status) { if (libraryMode) emit displayStatusbar("Fetching patch library: Recieved valid patch. ("+QString("%1").arg(100*lib.getNumPatches()/lib.getMaxNumPatches())+"% done)."); else emit displayStatusbar("Recieved valid patch."); } else { emit displayStatusbar("Recieved invalid patch."); } } else { emit displayStatusbar("Recieved unknown sysex."); #ifdef DEBUG qDebug() << "unknown sysex type"; #endif } delete message; emit redrawAll(); }
static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam) { HDITEMW item; if (((int) wParam) >= nTableColumnTypes) abort(); t->nColumns++; t->columnTypes = (int *) realloc(t->columnTypes, t->nColumns * sizeof (int)); if (t->columnTypes == NULL) abort(); t->columnTypes[t->nColumns - 1] = (int) wParam; ZeroMemory(&item, sizeof (HDITEMW)); item.mask = HDI_WIDTH | HDI_TEXT | HDI_FORMAT; item.cxy = 200; // TODO item.pszText = (WCHAR *) lParam; item.fmt = HDF_LEFT | HDF_STRING; if (SendMessage(t->header, HDM_INSERTITEM, (WPARAM) (t->nColumns - 1), (LPARAM) (&item)) == (LRESULT) (-1)) abort(); // TODO resize(t)? redrawAll(t); }
void ToolFrame::enableReact() { if( Change(enable_react,true) ) redrawAll(); }
void ReflowPage::run() { uint32_t start; // start off with a full page redraw redrawAll(); // go into a keypress/timeout event loop start=MillisecondTimer::millis(); for(;;) { // if we're cooking then the reflow object needs to get updated if(_mode==COOKING) { // update the reflow controller and stop the process when it's finished or aborted switch(_reflow->update()) { case Reflow::STOP: stopReflow(); break; case Reflow::UPDATED: plotProgress(); break; default: break; } } // each second, sample the temperature and display it // if we're cooking, show the power output if(MillisecondTimer::hasTimedOut(start,1000)) { drawTemperatureButton(); if(_mode==COOKING) drawPowerRectangle(); start=MillisecondTimer::millis(); } // check if any of the buttons has been pressed if(_buttonPressed) { // take action depending on which button it was switch(_buttonId) { case ButtonIdentifier::LEFT: handleDirection(); break; case ButtonIdentifier::RIGHT: handleDirection(); break; case ButtonIdentifier::OK: if(handleOk()) return; break; } // ready for the next press _buttonPressed=false; } } }
void ToolFrame::disableReact() { if( Change(enable_react,false) ) redrawAll(); }
void IBLWidget::gammaChanged( float v ) { gamma = v; redrawAll(); }
void IBLWidget::exposureChanged( float v ) { exposure = v; redrawAll(); }
static LRESULT CALLBACK tableWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { struct table *t; HDC dc; PAINTSTRUCT ps; NMHDR *nmhdr = (NMHDR *) lParam; NMHEADERW *nm = (NMHEADERW *) lParam; t = (struct table *) GetWindowLongPtrW(hwnd, GWLP_USERDATA); if (t == NULL) { // we have to do things this way because creating the header control will fail mysteriously if we create it first thing // (which is fine; we can get the parent hInstance this way too) if (uMsg == WM_NCCREATE) { CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam; t = (struct table *) malloc(sizeof (struct table)); if (t == NULL) abort(); ZeroMemory(t, sizeof (struct table)); t->hwnd = hwnd; // TODO this should be a global t->defaultFont = (HFONT) GetStockObject(SYSTEM_FONT); if (t->defaultFont == NULL) abort(); t->font = t->defaultFont; t->selected = 5;t->count=100;//TODO t->header = CreateWindowExW(0, WC_HEADERW, L"", // TODO is HOTTRACK needed? WS_CHILD | HDS_FULLDRAG | HDS_HORZ | HDS_HOTTRACK, 0, 0, 0, 0, t->hwnd, (HMENU) 100, cs->hInstance, NULL); if (t->header == NULL) abort(); {t->imagelist = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32, 1, 1); if(t->imagelist==NULL)abort(); { HICON icon; int unused; icon = LoadIconW(NULL, IDI_ERROR); if(icon == NULL)abort(); if (ImageList_AddIcon(t->imagelist, icon) == -1)abort(); if (ImageList_GetIconSize(t->imagelist, &unused, &(t->imagelistHeight)) == 0)abort(); } } t->checkboxes = makeCheckboxImageList(t->hwnd, &(t->theme), &(t->checkboxWidth), &(t->checkboxHeight)); t->focusedColumn = -1; SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) t); } // even if we did the above, fall through return DefWindowProcW(hwnd, uMsg, wParam, lParam); } switch (uMsg) { case WM_PAINT: dc = BeginPaint(hwnd, &ps); if (dc == NULL) abort(); drawItems(t, dc, ps.rcPaint); EndPaint(hwnd, &ps); return 0; case WM_SETFONT: t->font = (HFONT) wParam; if (t->font == NULL) t->font = t->defaultFont; // also set the header font SendMessageW(t->header, WM_SETFONT, wParam, lParam); if (LOWORD(lParam) != FALSE) { // the scrollbar page size will change so redraw that too // also recalculate the header height // TODO do that when this is FALSE too somehow resize(t); redrawAll(t); } return 0; case WM_GETFONT: return (LRESULT) t->font; case WM_VSCROLL: vscroll(t, wParam); return 0; case WM_MOUSEWHEEL: wheelscroll(t, wParam); return 0; case WM_HSCROLL: hscroll(t, wParam); return 0; case WM_SIZE: resize(t); return 0; case WM_LBUTTONDOWN: selectItem(t, wParam, lParam); return 0; case WM_SETFOCUS: case WM_KILLFOCUS: // all we need to do here is redraw the highlight // TODO ensure giving focus works right redrawRow(t, t->selected); return 0; case WM_KEYDOWN: keySelect(t, wParam, lParam); return 0; // TODO header double-click case WM_NOTIFY: if (nmhdr->hwndFrom == t->header) switch (nmhdr->code) { // I could use HDN_TRACK but wine doesn't emit that case HDN_ITEMCHANGING: case HDN_ITEMCHANGED: // TODO needed? recomputeHScroll(t); redrawAll(t); return FALSE; } return DefWindowProcW(hwnd, uMsg, wParam, lParam); // TODO others? case WM_WININICHANGE: case WM_SYSCOLORCHANGE: case WM_THEMECHANGED: if (ImageList_Destroy(t->checkboxes) == 0) abort(); t->checkboxes = makeCheckboxImageList(t->hwnd, &(t->theme), &(t->checkboxWidth), &(t->checkboxHeight)); resize(t); // TODO needed? redrawAll(t); // now defer back to DefWindowProc() in case other things are needed // TODO needed? return DefWindowProcW(hwnd, uMsg, wParam, lParam); case tableAddColumn: addColumn(t, wParam, lParam); return 0; case WM_GETOBJECT: // accessibility /* if (((DWORD) lParam) == OBJID_CLIENT) { TODO *server; LRESULT lResult; // TODO create the server object lResult = LresultFromObject(IID_IAccessible, wParam, server); if (/* TODO failure *|/) abort(); // TODO release object return lResult; } */ return DefWindowProcW(hwnd, uMsg, wParam, lParam); default: return DefWindowProcW(hwnd, uMsg, wParam, lParam); } abort(); return 0; // unreached }