static void place_line(QList<Q3DockData> &lastLine, Qt::Orientation o, int linestrut, int fullextent, int tbstrut, int maxsize, Q3DockAreaLayout *) { Q3DockWindow *last = 0; QRect lastRect; for (QList<Q3DockData>::Iterator it = lastLine.begin(); it != lastLine.end(); ++it) { if (tbstrut != -1 && qobject_cast<Q3ToolBar*>((*it).w)) (*it).rect.setHeight(tbstrut); if (!last) { last = (*it).w; lastRect = (*it).rect; continue; } if (!last->isStretchable()) { int w = qMin(lastRect.width(), maxsize); set_geometry(last, lastRect.x(), lastRect.y(), w, lastRect.height(), o); } else { int w = qMin((*it).rect.x() - lastRect.x(), maxsize); set_geometry(last, lastRect.x(), lastRect.y(), w, last->isResizeEnabled() ? linestrut : lastRect.height(), o); } last = (*it).w; lastRect = (*it).rect; } if (!last) return; if (!last->isStretchable()) { int w = qMin(lastRect.width(), maxsize); set_geometry(last, lastRect.x(), lastRect.y(), w, lastRect.height(), o); } else { int w = qMin(fullextent - lastRect.x() - (o == Qt::Vertical ? 1 : 0), maxsize); set_geometry(last, lastRect.x(), lastRect.y(), w, last->isResizeEnabled() ? linestrut : lastRect.height(), o); } }
void ToolTip::show_delayed(const Point &position, int delay_time) { if (is_visible()) return; set_geometry(Rect(position, get_size())); impl->timer_show_delayed.start(delay_time, false); }
void ToolTip::show(const Point &position) { if (is_visible()) return; set_geometry(Rect(position, get_size())); set_visible(true, false); }
int kinematicsForward(const double * joints, EmcPose * pos, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { set_geometry(*haldata->pfr, *haldata->tl, *haldata->sl, *haldata->fr); return kinematics_forward(joints, pos); }
void Info::set(int new_xpos, int new_ypos, const std::string &new_name) { name = new_name; activated_time = 0; activated_flag = false; request_repaint(); set_geometry(clan::Rect(new_xpos, new_ypos, clan::Size(120, 16))); }
void ToolTip::set_text(const std::string &text) { impl->text = text; Point top_left = get_geometry().get_top_left(); Canvas canvas = get_canvas(); Size text_size = get_render_text_size(canvas, impl->text); Rect rect(Point(0,0), text_size); set_geometry(Rect(top_left, impl->tooltip->get_size())); }
GridObject::GridObject(GridComponent *grid_component, clan::GUIComponent *parent, int id, const clan::Vec2i &pos) : clan::GUIComponent(parent), grid_component(grid_component), anchor_tl(clan::anchor_top_left), anchor_br(clan::anchor_top_left), component_type(0) { set_tag_name("object"); func_render().set(this, &GridObject::on_render); func_resized().set(this, &GridObject::on_resized); component_type = ComponentTypes::find_component(id); clan::GUIComponent *new_component = component_type->create_component(get_container()); set_geometry(clan::Rect(pos, new_component->get_size())); }
void ata_mass_storage_device::finished_command() { switch (m_command) { case IDE_COMMAND_IDENTIFY_DEVICE: if (m_can_identify_device) { for( int w = 0; w < 256; w++ ) { m_buffer[w * 2] = m_identify_buffer[ w ] & 0xff; m_buffer[(w * 2) + 1] = m_identify_buffer[ w ] >> 8; } m_status |= IDE_STATUS_DRQ; } else { m_status |= IDE_STATUS_ERR; m_error = IDE_ERROR_NONE; } set_irq(ASSERT_LINE); break; case IDE_COMMAND_SET_CONFIG: set_geometry(m_sector_count,(m_device_head & IDE_DEVICE_HEAD_HS) + 1); set_irq(ASSERT_LINE); break; case IDE_COMMAND_READ_SECTORS: case IDE_COMMAND_READ_SECTORS_NORETRY: case IDE_COMMAND_READ_MULTIPLE: case IDE_COMMAND_VERIFY_SECTORS: case IDE_COMMAND_VERIFY_SECTORS_NORETRY: case IDE_COMMAND_READ_DMA: finished_read(); break; case IDE_COMMAND_WRITE_SECTORS: case IDE_COMMAND_WRITE_SECTORS_NORETRY: case IDE_COMMAND_WRITE_MULTIPLE: case IDE_COMMAND_WRITE_DMA: finished_write(); break; case IDE_COMMAND_RECALIBRATE: set_irq(ASSERT_LINE); break; default: ata_hle_device::finished_command(); break; }
void PrefAgent::reset() { // Reset browse preferences. if (IS_CHANGED (f_browse_geo)) set_geometry (f_browse_geo, ORIGINAL_VALUE (f_browse_geo, WindowGeometry)); if (IS_CHANGED (f_fs_field)) set_integer (f_fs_field, ORIGINAL_VALUE (f_fs_field, Integer)); if (IS_CHANGED (f_lock_toggle)) { set_lock (ORIGINAL_VALUE (f_lock_toggle, Boolean)); f_lock_toggle.Unmap(); f_lock_toggle.Map(); } // Reset map preferences. if (IS_CHANGED (f_map_geo)) set_geometry (f_map_geo, ORIGINAL_VALUE (f_map_geo, WindowGeometry)); if (IS_CHANGED (f_update_toggle)) set_update (ORIGINAL_VALUE (f_update_toggle, Boolean)); // Reset history preferences. if (IS_CHANGED (f_nh_field)) set_integer (f_nh_field, ORIGINAL_VALUE (f_nh_field, Integer)); if (IS_CHANGED (f_sh_field)) set_integer (f_sh_field, ORIGINAL_VALUE (f_sh_field, Integer)); // Reset Search preferences. if (IS_CHANGED (f_max_hits_field)) set_integer (f_max_hits_field, ORIGINAL_VALUE (f_max_hits_field, Integer)); if (IS_CHANGED (f_adisplay_toggle)) set_auto_display (ORIGINAL_VALUE (f_adisplay_toggle, Boolean)); // Desensitize appropriate controls. f_ok.SetSensitive (False); f_apply.SetSensitive (False); f_reset.SetSensitive (False); }
GameViewChat::GameViewChat(GameView *view, Client *client) : GUIComponent(view, "chat"), client(client) { set_geometry(Rect(0, view->get_height() - 250, 250, view->get_height())); listview_chat = new ListView(this); listview_chat->set_geometry(Rect(0, 0, 450, 215)); ListViewColumnHeader chat_message_header = listview_chat->get_header()->create_column("message", "Message"); listview_chat->get_header()->append(chat_message_header); lineedit_chat = new LineEdit(this); lineedit_chat->set_geometry(Rect(0, 215, 450, 250)); lineedit_chat->func_enter_pressed().set(this, &GameViewChat::on_lineedit_chat_enter_pressed); }
void template_dialog::create_window(const QRectF &window_geometry, const QString &window_title, const QPointF &window_pos) { priv->m_main_window = new cherry_kit::window(); priv->m_main_window->set_widget_flag( cherry_kit::widget::kRenderBackground); priv->m_main_window->set_widget_flag( cherry_kit::widget::kConvertToWindowType); priv->m_main_window->set_widget_flag( cherry_kit::widget::kRenderDropShadow); set_geometry(window_geometry); update_content_geometry(priv->m_main_window); exec(window_pos); }
int main() { int tstep; char time_str[34]; time_t t0; // Set the parameters int Nx, Ny, Nz, TMAX; Nx = 200; Ny = 200; Nz = 208; TMAX = 100; // Allocate host memory float ***Ex, ***Ey, ***Ez; float ***Hx, ***Hy, ***Hz; float ***CEx, ***CEy, ***CEz; Ex = makeArray(Nx, Ny, Nz); Ey = makeArray(Nx, Ny, Nz); Ez = makeArray(Nx, Ny, Nz); Hx = makeArray(Nx, Ny, Nz); Hy = makeArray(Nx, Ny, Nz); Hz = makeArray(Nx, Ny, Nz); CEx = makeArray(Nx, Ny, Nz); CEy = makeArray(Nx, Ny, Nz); CEz = makeArray(Nx, Ny, Nz); // Geometry set_geometry(Nx, Ny, Nz, CEx, CEy, CEz); // Update on the CPU t0 = time(0); for ( tstep=1; tstep<=TMAX; tstep++) { updateE(Nx, Ny, Nz, Ex, Ey, Ez, Hx, Hy, Hz, CEx, CEy, CEz); updateSrc(Nx, Ny, Nz, Ex, tstep); updateH(Nx, Ny, Nz, Ex, Ey, Ez, Hx, Hy, Hz); if ( tstep/100*100 == tstep ) { //dumpToH5(Nx, Ny, Nz, Nx/2, 0, 0, Nx/2, Ny-1, Nz-1, Ex, "cpu_png/Ex-%05d.h5", tstep); //exec("h5topng -ZM0.1 -x0 -S4 -c /usr/share/h5utils/colormaps/dkbluered cpu_png/Ex-%05d.h5", tstep); updateTimer(t0, tstep, time_str); printf("tstep=%d\t%s\n", tstep, time_str); } } updateTimer(t0, tstep, time_str); printf("tstep=%d\t%s\n", tstep, time_str); }
void SpacePreviewActivity::create_window(const QRectF &window_geometry, const QString &window_title, const QPointF &window_pos) { d->m_main_window = new UIKit::Window(); d->m_main_window->set_widget_flag(UIKit::Widget::kRenderBackground); d->m_main_window->set_widget_flag(UIKit::Widget::kConvertToWindowType); d->m_main_window->set_widget_flag(UIKit::Widget::kRenderDropShadow); set_geometry(window_geometry); update_content_geometry(d->m_main_window); exec(window_pos); d->m_main_window->on_window_discarded([this](UIKit::Window *aWindow) { discard_activity(); }); }
GameViewEnd::GameViewEnd(GameView *view) : GUIComponent(view, "game-over") { set_visible(false); set_geometry(Rect(view->get_width() / 2 - 200, view->get_height() / 2 - 150, view->get_width() / 2 + 200, view->get_height() / 2 + 150)); label_title = new Label(this); label_title->set_tag_name("title"); label_title->set_geometry(Rect(10, 10, 100, 30)); label_message = new Label(this); label_message->set_tag_name("title"); label_message->set_geometry(Rect(10, 40, 100, 70)); button_close = new PushButton(this); button_close->set_tag_name("close"); button_close->set_text("Close"); button_close->set_geometry(Rect(10, 80, 100, 110)); button_close->func_clicked().set(this, &GameViewEnd::on_button_close_clicked); }
GameViewBattle::GameViewBattle(GameView *view, Client *client) : CL_GUIComponent(view), view(view), client(client) { set_type_name("battle"); set_geometry(CL_Rect(view->get_width() - 400, 0, view->get_width(), 300)); set_visible(false); func_render().set(this, &GameViewBattle::on_render); func_process_message().set(this, &GameViewBattle::on_message); timer_hide.func_expired().set(this, &GameViewBattle::on_timer_hide_expired); CL_Texture texture_dice(get_gc(), "Resources/dices.png", CL_VirtualDirectory()); CL_SpriteDescription dice_description; dice_description.add_gridclipped_frames(texture_dice, 0, 0, 42, 45, 6, 1); sprite_dices = CL_Sprite(get_gc(), dice_description); font_large = CL_Font(get_gc(), "Accidental Presidency", -40); font_small = CL_Font(get_gc(), "Accidental Presidency", -30); }
static struct biosdisk * alloc_biosdisk(int biosdev) { struct biosdisk *d; d = alloc(sizeof(*d)); if (d == NULL) return NULL; memset(d, 0, sizeof(*d)); d->ll.dev = biosdev; if (set_geometry(&d->ll, NULL)) { #ifdef DISK_DEBUG printf("no geometry information\n"); #endif dealloc(d, sizeof(*d)); return NULL; } return d; }
void rxvt_image::set_file_geometry (rxvt_screen *s, const char *file) { if (!file || !*file) return; const char *p = strchr (file, ';'); if (p) { size_t len = p - file; char *f = rxvt_temp_buf<char> (len + 1); memcpy (f, file, len); f[len] = '\0'; file = f; } set_file (s, file); alpha = 0x8000; set_geometry (p ? p + 1 : ""); }
void CodLinkCanvas::menu(const QPoint&) { bool new_dirs; CodDirsCanvas * d = find_dirs(); CodObjCanvas * from; CodObjCanvas * to; get_start_end(from, to); if (d == 0) { new_dirs = TRUE; (d = dirs = new CodDirsCanvas(the_canvas(), this, 0))->show(); } else new_dirs = FALSE; Q3PopupMenu m; Q3PopupMenu geo; m.insertItem(new MenuTitle(TR("Link"), m.font()), -1); m.insertSeparator(); m.insertItem(TR("add messages to ") + from->get_full_name(), 1); m.insertItem(TR("add messages to ") + to->get_full_name(), 2); m.insertSeparator(); m.insertItem(TR("Edit its messages"), 3); m.insertItem(TR("Edit all the messages"), 4); m.insertSeparator(); m.insertItem(TR("Select linked items"), 7); m.insertSeparator(); if (!new_dirs) { m.insertItem(TR("Edit drawing settings"), 5); m.insertSeparator(); } if (get_start() != get_end()) { init_geometry_menu(geo, 10); m.insertItem(TR("Geometry (Ctrl+l)"), &geo); m.insertSeparator(); } m.insertItem(TR("Remove from diagram"), 6); int rank = m.exec(QCursor::pos()); switch (rank) { case 1: { CodAddMsgDialog dialog(to, from, d, (ColDiagramView *) the_canvas()->get_view(), FALSE); dialog.raise(); if (dialog.exec() != QDialog::Accepted) return; } break; case 2: { CodAddMsgDialog dialog(from, to, d, (ColDiagramView *) the_canvas()->get_view(), TRUE); dialog.raise(); if (dialog.exec() != QDialog::Accepted) return; } break; case 3: CodEditMsgDialog::exec((ColDiagramView *) the_canvas()->get_view(), d->get_msgs()); return; case 4: CodEditMsgDialog::exec((ColDiagramView *) the_canvas()->get_view(), ((ColDiagramView *) the_canvas()->get_view())->get_msgs()); return; case 5: if (d->edit_drawing_settings()) modified(); return; case 6: delete_it(); ((ColDiagramView *) the_canvas()->get_view())->update_msgs(); break; case 7: select_associated(); return; default: if (rank >= 10) { rank -= 10; if (rank == RecenterBegin) set_decenter(-1.0, decenter_end); else if (rank == RecenterEnd) set_decenter(decenter_begin, -1.0); else if (rank != (int) geometry) set_geometry((LineGeometry) rank, TRUE); else return; } else return; } package_modified(); if (new_dirs && (dirs != 0)) { if (dirs->get_msgs().count() == 0) { dirs->delete_it(); dirs = 0; } else dirs->update_pos(beginp, endp); } }
void bi_getbiosgeom() { struct btinfo_biosgeom *bibg; int i, j, nvalid; unsigned char nhd; unsigned int cksum; pvbcopy((void *)(0x400 + 0x75), &nhd, 1); #ifdef GEOM_DEBUG printf("nhd %d\n", (int)nhd); #endif bibg = alloc(sizeof(struct btinfo_biosgeom) + (nhd - 1) * sizeof(struct bi_biosgeom_entry)); if (!bibg) return; for (i = nvalid = 0; i < MAX_BIOSDISKS && nvalid < (int)nhd; i++) { struct biosdisk_ll d; struct biosdisk_ext13info ed; char buf[BIOSDISK_SECSIZE]; d.dev = 0x80 + i; if (set_geometry(&d, &ed)) continue; bzero(&bibg->disk[nvalid], sizeof(bibg->disk[nvalid])); bibg->disk[nvalid].sec = d.sec; bibg->disk[nvalid].head = d.head; bibg->disk[nvalid].cyl = d.cyl; bibg->disk[nvalid].dev = d.dev; if (readsects(&d, 0, 1, buf, 0)) { bibg->disk[nvalid].flags |= BI_GEOM_INVALID; nvalid++; continue; } #ifdef GEOM_DEBUG printf("#%d: %x: C %d H %d S %d\n", nvalid, d.dev, d.cyl, d.head, d.sec); #endif if (d.flags & BIOSDISK_EXT13) { if (ed.flags & EXT13_GEOM_VALID) bibg->disk[nvalid].totsec = ed.totsec; else bibg->disk[nvalid].totsec = 0; bibg->disk[nvalid].flags |= BI_GEOM_EXTINT13; } for (j = 0, cksum = 0; j < BIOSDISK_SECSIZE; j++) cksum += buf[j]; bibg->disk[nvalid].cksum = cksum; bcopy(&buf[MBR_PARTOFF], bibg->disk[nvalid].dosparts, sizeof(bibg->disk[nvalid].dosparts)); nvalid++; } bibg->num = nvalid; BI_ADD(bibg, BTINFO_BIOSGEOM, sizeof(struct btinfo_biosgeom) + nvalid * sizeof(struct bi_biosgeom_entry)); }
void biosdisk_probe(void) { struct biosdisk d; struct biosdisk_extinfo ed; uint64_t size; int first; int i; #if !defined(NO_DISKLABEL) || !defined(NO_GPT) int part; #endif for (i = 0; i < MAX_BIOSDISKS + 2; i++) { first = 1; memset(&d, 0, sizeof(d)); memset(&ed, 0, sizeof(ed)); if (i >= MAX_BIOSDISKS) d.ll.dev = 0x00 + i - MAX_BIOSDISKS; /* fd */ else d.ll.dev = 0x80 + i; /* hd/cd */ if (set_geometry(&d.ll, &ed)) continue; printf("disk "); switch (d.ll.type) { case BIOSDISK_TYPE_CD: printf("cd0\n cd0a\n"); break; case BIOSDISK_TYPE_FD: printf("fd%d\n", d.ll.dev & 0x7f); printf(" fd%da\n", d.ll.dev & 0x7f); break; case BIOSDISK_TYPE_HD: printf("hd%d", d.ll.dev & 0x7f); if (d.ll.flags & BIOSDISK_INT13EXT) { printf(" size "); size = ed.totsec * ed.sbytes; if (size >= (10ULL * 1024 * 1024 * 1024)) printf("%"PRIu64" GB", size / (1024 * 1024 * 1024)); else printf("%"PRIu64" MB", size / (1024 * 1024)); } printf("\n"); break; } #if !defined(NO_DISKLABEL) || !defined(NO_GPT) if (d.ll.type != BIOSDISK_TYPE_HD) continue; if (read_partitions(&d) != 0) continue; for (part = 0; part < BIOSDISKNPART; part++) { if (d.part[part].size == 0) continue; if (d.part[part].fstype == FS_UNUSED) continue; if (first) { printf(" "); first = 0; } printf(" hd%d%c(", d.ll.dev & 0x7f, part + 'a'); if (d.part[part].fstype < FSMAXTYPES) printf("%s", fstypenames[d.part[part].fstype]); else printf("%d", d.part[part].fstype); printf(")"); } #endif if (first == 0) printf("\n"); } }
static void set_all_geometries(device_t *device, floppy_type_t type) { set_geometry(device->machine().device(PFLOPPY_0), type); set_geometry(device->machine().device(PFLOPPY_1), type); set_geometry(device->machine().device(PFLOPPY_2), type); }
void AssocContainCanvas::menu(const QPoint&) { Q3PopupMenu m(0); Q3PopupMenu geo(0); ArrowCanvas * aplabel; ArrowCanvas * apstereotype; search_supports(aplabel, apstereotype); AssocContainCanvas * plabel = (AssocContainCanvas *) aplabel; AssocContainCanvas * pstereotype = (AssocContainCanvas *) apstereotype; MenuFactory::createTitle(m, TR("Association")); m.insertSeparator(); m.insertItem(TR("Edit"),1); if (pstereotype || plabel) { m.insertSeparator(); m.insertItem(TR("Select stereotype and label"), 2); m.insertItem(TR("Default stereotype and label position"), 3); if (plabel && (label == 0)) m.insertItem(TR("Attach label to this segment"), 4); if (pstereotype && (stereotype == 0)) m.insertItem(TR("Attach stereotype to this segment"), 5); } if (get_start() != get_end()) { m.insertSeparator(); init_geometry_menu(geo, 10); m.insertItem(TR("Geometry (Ctrl+l)"), &geo); } m.insertSeparator(); m.insertItem(TR("Remove from diagram"), 6); m.insertItem(TR("Delete from model"), 7); int rank = m.exec(QCursor::pos()); switch (rank) { case 1: open(); return; case 2: the_canvas()->unselect_all(); if (plabel) the_canvas()->select(plabel->label); if (pstereotype) the_canvas()->select(pstereotype->stereotype); return; case 3: if (plabel) plabel->default_label_position(); if (pstereotype) pstereotype->default_stereotype_position(); break; case 4: label = plabel->label; plabel->label = 0; default_label_position(); break; case 5: stereotype = pstereotype->stereotype; pstereotype->stereotype = 0; default_stereotype_position(); break; case 6: // not removed from the model : just hide it remove(FALSE); break; case 7: get_start()->unassociate(get_end()); // line will be deleted break; default: if (rank >= 10) { rank -= 10; if (rank == RecenterBegin) set_decenter(-1.0, decenter_end); else if (rank == RecenterEnd) set_decenter(decenter_begin, -1.0); else if (rank != (int) geometry) set_geometry((LineGeometry) rank, TRUE); else return; } else return; } package_modified(); }
void TimeZoneActivity::create_window(const QRectF &aWindowGeometry, const QString &aWindowTitle, const QPointF &aWindowPos) { m_priv_ptr->m_window_ptr = new UIKit::Window(); m_priv_ptr->m_window_ptr->set_window_title(aWindowTitle); m_priv_ptr->m_content_widget_ptr = new UIKit::Widget(m_priv_ptr->m_window_ptr); m_priv_ptr->m_content_widget_ptr->setGeometry(aWindowGeometry); m_priv_ptr->m_filter_widget_ptr = new UIKit::LineEdit(m_priv_ptr->m_content_widget_ptr); m_priv_ptr->m_filter_widget_ptr->setMinimumSize(aWindowGeometry.width() - 16, 32); m_priv_ptr->m_filter_widget_ptr->setGeometry(QRectF(8, 0, 0, 0)); m_priv_ptr->m_timezone_browser_ptr = new UIKit::ItemView(m_priv_ptr->m_content_widget_ptr); /* m_priv_ptr->m_timezone_browser_ptr->setGeometry( QRectF(0, 0, aWindowGeometry.width(), aWindowGeometry.height() - m_priv_ptr->m_filter_widget_ptr->minimumHeight())); */ m_priv_ptr->m_timezone_browser_ptr->set_view_geometry( QRectF(0, 0, aWindowGeometry.width() - 16, aWindowGeometry.height() - m_priv_ptr->m_filter_widget_ptr->minimumHeight())); m_priv_ptr->m_timezone_browser_ptr->setPos( 18, m_priv_ptr->m_filter_widget_ptr->minimumHeight() + 8); m_priv_ptr->m_filter_widget_ptr->show(); m_priv_ptr->m_window_ptr->set_window_content( m_priv_ptr->m_content_widget_ptr); set_geometry(aWindowGeometry); exec(aWindowPos); m_priv_ptr->m_filter_widget_ptr->on_insert([&](const QString &a_txt) { m_priv_ptr->m_timezone_browser_ptr->set_filter(a_txt); }); m_priv_ptr->m_window_ptr->on_window_discarded([this](UIKit::Window *aWindow) { if (m_priv_ptr->m_timezone_browser_ptr) { m_priv_ptr->m_timezone_browser_ptr->clear(); delete m_priv_ptr->m_timezone_browser_ptr; m_priv_ptr->m_timezone_browser_ptr = 0; } discard_activity(); }); m_priv_ptr->m_timezone_browser_ptr->on_item_removed( [](UIKit::ModelViewItem *a_item) { if (a_item) delete a_item; }); loadTimeZones(); }
Portal::Portal() : QMainWindow(), m_workspace(NULL), m_open_mapper(NULL), m_history_mapper(NULL), m_activation_mapper(NULL), m_properties_mapper(NULL), m_filehist_menu(NULL), m_file_menu(NULL), m_window_menu(NULL), m_help_menu(NULL), m_file_toolbar(NULL), m_render_toolbar(NULL), m_open_action(NULL), m_help_action(NULL), m_exit_action(NULL), m_tile_action(NULL), m_cascade_action(NULL), m_close_action(NULL), m_flat_action(NULL), m_phong_action(NULL), m_wireframe_action(NULL), m_center_action(NULL), m_culling_action(NULL), m_texture_action(NULL), m_shading_actions(NULL), m_open_dialog(NULL), m_tool_docker(NULL), m_tool_tab(NULL), m_console(NULL), m_cout_buffer(NULL), m_cerr_buffer(NULL) { m_workspace = new QWorkspace; m_workspace->setScrollBarsEnabled(true); connect( m_workspace, SIGNAL(windowActivated(QWidget*)), this, SLOT(window_activated(QWidget*)) ); connect( m_workspace, SIGNAL(windowActivated(QWidget*)), this, SLOT(handle_glpad_propchange(QWidget*)) ); this->setCentralWidget(m_workspace); m_open_mapper = new QSignalMapper(this); connect( m_open_mapper, SIGNAL(mapped(const QString &)), this, SLOT(open(const QString &))); m_history_mapper = new QSignalMapper(this); connect( m_history_mapper, SIGNAL(mapped(const QString &)), this, SLOT(update_history(const QString &))); m_activation_mapper = new QSignalMapper(this); connect( m_activation_mapper, SIGNAL(mapped(QWidget*)), m_workspace, SLOT(setActiveWindow(QWidget*)) ); m_properties_mapper = new QSignalMapper(this); connect( m_properties_mapper, SIGNAL(mapped(QWidget*)), this, SLOT(handle_glpad_propchange(QWidget*)) ); int isize = Config::main()->get( "icon::size" ).toInt(); this->setIconSize( QSize( isize, isize ) ); construct_actions(); construct_menus(); construct_toolbars(); construct_dialogs(); construct_dockers(); construct_console(); set_geometry(); set_window_state(); this->setWindowTitle( tr("Boxfish3d") ); this->setWindowIcon( Svg_icon( ":/icons/boxfish3d.svg", QSize(32,32 ) ) ); if( Config::main()->defined( "portal::state" ) ) { this->restoreState( Config::main()->get( "portal::state" ).toUtf8() ); } int count = 0; QString fname; do { fname = Config::main()->get( QString("file::history::list::item") + QString::number(count) ); count++; if( !fname.isNull() ) m_file_history.push_back( fname ); } while( !fname.isNull() ); }
void SimpleRelationCanvas::menu(const QPoint &) { if ((data != 0) && !data->get_start()->in_edition()) { SimpleRelationCanvas * pstereotype; { ArrowCanvas * aplabel; // cannot exist ArrowCanvas * apstereotype; search_supports(aplabel, apstereotype); pstereotype = (SimpleRelationCanvas *) apstereotype; } Q3PopupMenu m(0); Q3PopupMenu geo(0); Q3PopupMenu toolm(0); MenuFactory::createTitle(m, data->definition(FALSE, TRUE)); m.insertSeparator(); m.insertItem("Edit", 0); m.insertSeparator(); m.insertItem("Select in browser", 2); if (pstereotype) { m.insertSeparator(); m.insertItem("Select stereotype", 3); m.insertItem("Stereotype default position", 4); if (stereotype == 0) m.insertItem("Attach stereotype to this segment", 6); } if (get_start() != get_end()) { m.insertSeparator(); init_geometry_menu(geo, 10); m.insertItem("Geometry (Ctrl+l)", &geo); } m.insertSeparator(); m.insertItem("Remove from diagram", 7); if (data->get_start()->is_writable()) m.insertItem("Delete from model", 8); m.insertSeparator(); if (Tool::menu_insert(&toolm, itstype, 20)) m.insertItem("Tool", &toolm); int rank = m.exec(QCursor::pos()); switch (rank) { case 0: data->edit(); return; case 2: data->get_start()->select_in_browser(); return; case 3: the_canvas()->unselect_all(); the_canvas()->select(pstereotype->stereotype); return; case 4: pstereotype->stereotype_default_position(); return; case 6: stereotype = pstereotype->stereotype; pstereotype->stereotype = 0; stereotype_default_position(); break; case 7: // not removed from the browser : just hide it remove(FALSE); break; case 8: data->delete_it(); // will delete the canvas break; default: if (rank >= 20) { ToolCom::run(Tool::command(rank - 20), data->get_start()); return; } else if (rank >= 10) { rank -= 10; if (rank == RecenterBegin) set_decenter(-1.0, decenter_end); else if (rank == RecenterEnd) set_decenter(decenter_begin, -1.0); else if (rank != (int) geometry) set_geometry((LineGeometry) rank, TRUE); else return; } else return; } package_modified(); } }
void RadialMenu::show(CL_Point &position) { set_geometry(CL_Rect(position.x - 120, position.y - 120, position.x + 120, position.y + 120)); set_visible(true); capture_mouse(true); }
xlui::push_button::push_button(const xlui::string &label, xlui::control *parent, const xlui::string &name) : xlui::abstract_button(label, parent, name) { _checkable = false; set_geometry(0, 0, 83, 24); _text_align = AlignCenter | AlignMiddle; }
/******************************************************************************************* Video capture routines - set input - setup_pixelformat - set_geometry - set_brightness - set_chroma - set_contrast - set_channelset - set_channel - set_capture_mode */ static unsigned char *v4l_start(struct video_dev *viddev, int width, int height, unsigned short input, unsigned short norm, unsigned long freq) { int dev_bktr = viddev->fd_bktr; struct sigaction act, old; //int dev_tunner = viddev->fd_tuner; /* to ensure that all device will be support the capture mode _TODO_ : Autodected the best capture mode . */ int dummy = 1; // int pixelformat = BSD_VIDFMT_I420; void *map; /* if we have choose the tuner is needed to setup the frequency */ if ((viddev->tuner_device != NULL) && (input == IN_TV)) { if (!freq) { motion_log(LOG_ERR, 0, "%s: Not valid Frequency [%lu] for Source input [%i]", __FUNCTION__, freq, input); return NULL; } else if (set_freq(viddev, freq) == -1) { motion_log(LOG_ERR, 0, "%s: Frequency [%lu] Source input [%i]", __FUNCTION__, freq, input); return NULL; } } /* FIXME if we set as input tuner , we need to set option for tuner not for bktr */ if ((dummy = set_input(viddev, input)) == -1) { motion_log(LOG_ERR, 0, "%s: set input [%d]", __FUNCTION__, input); return NULL; } viddev->input = dummy; if ((dummy = set_input_format(viddev, norm)) == -1) { motion_log(LOG_ERR, 0, "%s: set input format [%d]", __FUNCTION__, norm); return NULL; } viddev->norm = dummy; if (set_geometry(viddev, width, height) == -1) { motion_log(LOG_ERR, 0, "%s: set geometry [%d]x[%d]", __FUNCTION__, width, height); return NULL; } /* if (ioctl(dev_bktr, METEORSACTPIXFMT, &pixelformat) < 0) { motion_log(LOG_ERR, 1, "set encoding method BSD_VIDFMT_I420"); return NULL; } NEEDED !? FIXME if (setup_pixelformat(viddev) == -1) return NULL; */ if (freq) { if (debug_level >= CAMERA_DEBUG) motion_log(-1, 0, "%s: Frequency set (no implemented yet", __FUNCTION__); /* TODO missing implementation set_channelset(viddev); set_channel(viddev); if (set_freq (viddev, freq) == -1) { return NULL; } */ } /* set capture mode and capture buffers */ /* That is the buffer size for capture images , so is dependent of color space of input format / FIXME */ viddev->v4l_bufsize = (((width * height * 3 / 2)) * sizeof(unsigned char *)); viddev->v4l_fmt = VIDEO_PALETTE_YUV420P; map = mmap((caddr_t)0, viddev->v4l_bufsize, PROT_READ|PROT_WRITE, MAP_SHARED, dev_bktr, (off_t)0); if (map == MAP_FAILED){ motion_log(LOG_ERR, 1, "%s: mmap failed", __FUNCTION__); return NULL; } /* FIXME double buffer */ if (0) { viddev->v4l_maxbuffer = 2; viddev->v4l_buffers[0] = map; viddev->v4l_buffers[1] = (unsigned char *)map + 0; /* 0 is not valid just a test */ //viddev->v4l_buffers[1] = map+vid_buf.offsets[1]; } else { viddev->v4l_buffers[0] = map; viddev->v4l_maxbuffer = 1; } viddev->v4l_curbuffer = 0; /* Clear the buffer */ if (ioctl(dev_bktr, BT848SCBUF, &dummy) < 0) { motion_log(LOG_ERR, 1, "%s: BT848SCBUF", __FUNCTION__); return NULL; } /* signal handler to know when data is ready to be read() */ memset(&act, 0, sizeof(act)); sigemptyset(&act.sa_mask); act.sa_handler = catchsignal; sigaction(SIGUSR2, &act, &old); dummy = SIGUSR2; //viddev->capture_method = METEOR_CAP_CONTINOUS; //viddev->capture_method = METEOR_CAP_SINGLE; if ((viddev->capture_method == METEOR_CAP_CONTINOUS) && (ioctl(dev_bktr, METEORSSIGNAL, &dummy) < 0)) { motion_log(LOG_ERR, 1, "%s: METEORSSIGNAL", __FUNCTION__); motion_log(LOG_INFO, 0 , "%s: METEORSSIGNAL", __FUNCTION__); viddev->capture_method = METEOR_CAP_SINGLE; if (ioctl(dev_bktr, METEORCAPTUR, &viddev->capture_method) < 0) { motion_log(LOG_ERR, 1, "%s: METEORCAPTUR using single method " "Error capturing", __FUNCTION__); motion_log(LOG_INFO, 0, "%s: METEORCAPTUR using single method " "Error capturing", __FUNCTION__); } } else { if (ioctl(dev_bktr, METEORCAPTUR, &viddev->capture_method) < 0) { viddev->capture_method = METEOR_CAP_SINGLE; if (ioctl(dev_bktr, METEORCAPTUR, &viddev->capture_method) < 0) { motion_log(LOG_ERR, 1, "%s: METEORCAPTUR using single method " "Error capturing", __FUNCTION__); motion_log(LOG_INFO, 0, "%s: METEORCAPTUR using single method " "Error capturing", __FUNCTION__); } } } if (viddev->capture_method == METEOR_CAP_CONTINOUS) motion_log(LOG_INFO, 0, "%s: METEORCAPTUR METEOR_CAP_CONTINOUS", __FUNCTION__); else motion_log(LOG_INFO, 0, "%s: METEORCAPTUR METEOR_CAP_SINGLE", __FUNCTION__); // settle , sleep(1) replaced SLEEP(1, 0); /* FIXME*/ switch (viddev->v4l_fmt) { case VIDEO_PALETTE_YUV420P: viddev->v4l_bufsize = (width * height * 3) / 2; break; case VIDEO_PALETTE_YUV422: viddev->v4l_bufsize = (width * height * 2); break; case VIDEO_PALETTE_RGB24: viddev->v4l_bufsize = (width * height * 3); break; case VIDEO_PALETTE_GREY: viddev->v4l_bufsize = width * height; break; } motion_log(LOG_INFO, 0, "HUE [%d]", get_hue(dev_bktr, &dummy)); motion_log(LOG_INFO, 0, "SATURATION [%d]", get_saturation(dev_bktr, &dummy)); motion_log(LOG_INFO, 0, "BRIGHTNESS [%d]", get_brightness(dev_bktr, &dummy)); motion_log(LOG_INFO, 0, "CONTRAST [%d]", get_contrast(dev_bktr, &dummy)); return map; }
static void set_all_geometries(device_t *device, floppy_type_t type) { set_geometry(device->siblingdevice(FLOPPY_0), type); set_geometry(device->siblingdevice(FLOPPY_1), type); set_geometry(device->siblingdevice(FLOPPY_2), type); }
void PrefAgent::get_geometry (WCallback *wcb) { WXmTextField text_field ((Widget)wcb->ClientData()); char *shell_name = NULL; if (text_field == f_map_geo) shell_name = (char*)"map"; else if (text_field == f_browse_geo) shell_name = (char*)"nodeview"; // Display an instructional dialog. WXmMessageDialog info_dialog ((Widget)f_shell, (char*)"geometry_msg", WArgList (XmNdialogType, XmDIALOG_INFORMATION, NULL)); WXmDialogShell shell (info_dialog.Parent()); // set window title String string = CATGETS(Set_PrefAgent, 2, "Dtinfo: Get Geometry"); XtVaSetValues((Widget)shell, XmNtitle, string, NULL); // window_system().register_full_modal_shell (&shell); info_dialog.MessageString ( (char*)UAS_String(CATGETS(Set_Messages, 16, "File a Bug"))); XtUnmanageChild (info_dialog.OkPB()); XtUnmanageChild (info_dialog.HelpPB()); XtVaSetValues((Widget)info_dialog, XmNdefaultPosition, False, NULL); // Wait for the dialog to appear. int mapped = FALSE; info_dialog.Manage(); XtAddEventHandler (info_dialog, ExposureMask, False, dialog_mapped, (XtPointer) &mapped); XtAppContext app_context = window_system().app_context(); XEvent event; while (!mapped) { XtAppNextEvent (app_context, &event); XtDispatchEvent (&event); } // Let the user pick an OLIAS window. static Cursor pick_cursor = XCreateFontCursor (window_system().display(), XC_crosshair); Widget target; target = XmTrackingEvent (f_shell, pick_cursor, False, &event); // Get the geometry of the selected window. while (target != NULL && !XtIsShell (target)) target = XtParent (target); if (target != (Widget) info_dialog.Parent()) { // Make sure the user clicked on the right kind of window. if (target != NULL && strcmp (XtName(target), shell_name) != 0) target = NULL; if (target == NULL) { XBell (window_system().display(), 100); } else { WShell shell (target); WindowGeometry wg; wg.width = shell.Width(); wg.height = shell.Height(); set_geometry (text_field, wg); } } // Nuke the dialog. info_dialog.Unmanage(); XtDestroyWidget (info_dialog.Parent()); }