//recursive function void World::trace_scene(Scene_info &info, Directional_ray &ray, Directional_ray &spec_light, int rec_ctr, int cur_obj_idx, float min_distance, int i, int j, Vector3d &amb_dir, float factor, Point3d &cur_orig) { if(rec_ctr <= 0) return; for (int o = 0; o < _objects.size(); ++o){ if((o != cur_obj_idx)){//dont hit yourself again if( _tracer->hit(ray, _objects[o], info) ){ //get the color //lambertian shading //calculate the cos value if(_objects[o]->type() == obj_type::Triangle){ Triangle* cur_tri = reinterpret_cast<Triangle*>(_objects[o]); Vector3d tri_normal = cur_tri->get_n(); update_color(info, i, j, tri_normal, amb_dir, 1.f); } else if(_objects[o]->type() == obj_type::Sphere){//sphere Sphere* cur_sph = reinterpret_cast<Sphere*>(_objects[o]); Vector3d normal_hit = info._hit_point - cur_sph->center(); normal_hit.normalize_vector(); if(rec_ctr == MAX_RECURSE_NUM)//first time update_color(info, i, j, normal_hit, amb_dir, 1.f); else//average color update_color(info, i, j, normal_hit, amb_dir, factor); Directional_ray new_ray(ray); Scene_info new_info(info); update_dir_and_org(new_info, new_ray, normal_hit); trace_scene(new_info, new_ray, spec_light, (rec_ctr-1), o, min_distance, i, j, amb_dir, factor/2, cur_orig); //calaulate spec Vector3d view_vec = info._hit_point - cur_orig; view_vec.normalize_vector(); Directional_ray new_spec(spec_light); update_dir_and_org(new_info, new_spec, normal_hit); Vector3d spec_hit = new_spec.get_dir(); update_spec(info, i, j, spec_hit, view_vec, spec_light); } else { //simply copy the color copy_info_color(info, i, j); } } } } }
ColorWidget ( QWidget* parent = NULL ) : QLineEdit(parent) { setReadOnly(true); connect(&color_dialog,SIGNAL(currentColorChanged(QColor)), SLOT(update_color(QColor)) ); connect(&color_dialog,SIGNAL(colorSelected(QColor)), SLOT(update_color(QColor)) ); //connect(this,SIGNAL(editingFinished()),SLOT(update_from_text())); connect(&color_dialog,SIGNAL(finished(int)),SIGNAL(dialog_closed())); color_dialog.setOptions(QColorDialog::ShowAlphaChannel|QColorDialog::NoButtons); update_color(color()); }
static void cndfs_handle_nonseed_accepting (wctx_t *ctx) { alg_local_t *loc = ctx->local; cndfs_alg_local_t *cloc = (cndfs_alg_local_t *) ctx->local; size_t nonred, accs; nonred = accs = dfs_stack_size(cloc->out_stack); if (nonred) { loc->counters.waits++; cloc->counters.rec += accs; RTstartTimer (cloc->timer); while ( nonred && !run_is_stopped(ctx->run) ) { nonred = 0; for (size_t i = 0; i < accs; i++) { raw_data_t state_data = dfs_stack_peek (cloc->out_stack, i); state_info_deserialize (ctx->state, state_data); if (state_store_get_colors (ctx->state->ref) != CRED) nonred++; } } RTstopTimer (cloc->timer); } for (size_t i = 0; i < accs; i++) dfs_stack_pop (cloc->out_stack); while ( dfs_stack_size(cloc->in_stack) ) { raw_data_t state_data = dfs_stack_pop (cloc->in_stack); state_info_deserialize (ctx->state, state_data); if (update_color(ctx, ctx->state->ref, CRED, 1)) loc->red_work.explored++; } }
Gobby::TabLabel::TabLabel(Folder& folder, SessionView& view, const Glib::ustring& active_icon_name): m_folder(folder), m_view(view), m_title(view.get_title()), m_changed(false), m_active_icon_name(active_icon_name) { set_column_spacing(6); m_title.set_halign(Gtk::ALIGN_START); update_icon(); update_color(); m_icon.show(); m_title.show(); m_button.set_halign(Gtk::ALIGN_END); m_button.show(); view.signal_active_user_changed().connect( sigc::mem_fun(*this, &TabLabel::on_active_user_changed)); m_notify_status_handle = g_signal_connect( G_OBJECT(view.get_session()), "notify::status", G_CALLBACK(on_notify_status_static), this); m_notify_subscription_group_handle = g_signal_connect( G_OBJECT(view.get_session()), "notify::subscription-group", G_CALLBACK(on_notify_subscription_group_static), this); m_folder.signal_document_changed().connect( sigc::mem_fun(*this, &TabLabel::on_folder_document_changed)); attach(m_icon, 0, 0, 1, 1); attach(m_title, 1, 0, 1, 1); attach(m_button, 2, 0, 1, 1); }
Gobby::TabLabel::TabLabel(Folder& folder, SessionView& view, const Glib::ustring& active_icon_name): Gtk::HBox(false, 6), m_folder(folder), m_view(view), m_title(view.get_title()), m_changed(false), m_active_icon_name(active_icon_name) { m_title.set_alignment(Gtk::ALIGN_START); update_icon(); update_color(); m_icon.show(); m_title.show(); m_extra.show(); m_button.show(); view.signal_active_user_changed().connect( sigc::mem_fun(*this, &TabLabel::on_active_user_changed)); m_notify_status_handle = g_signal_connect( G_OBJECT(view.get_session()), "notify::status", G_CALLBACK(on_notify_status_static), this); m_notify_subscription_group_handle = g_signal_connect( G_OBJECT(view.get_session()), "notify::subscription-group", G_CALLBACK(on_notify_subscription_group_static), this); m_folder.signal_document_changed().connect( sigc::mem_fun(*this, &TabLabel::on_folder_document_changed)); pack_start(m_icon, Gtk::PACK_SHRINK); pack_start(m_title, Gtk::PACK_SHRINK); pack_start(m_extra, Gtk::PACK_EXPAND_WIDGET); pack_end(m_button, Gtk::PACK_SHRINK); }
void Gobby::TabLabel::set_changed() { if(m_folder.get_current_document() != &m_view) { m_changed = true; update_color(); } }
bool Fader::fade_out( float speed ) { fade_ = math::chase( fade_, 1.f, speed ); update_color(); return fade_ == 1.f; }
bool Fader::fade_in( float speed ) { fade_ = math::chase( fade_, 0.f, speed ); update_color(); return fade_ == 0.f; }
static void tick_handler(struct tm *tick_time, TimeUnits units_changed) { if(isShowingSeconds && (difftime(time(NULL), timeOfLastTap) > DURATION_OF_SECONDS_AFTER_TAP)) { isShowingSeconds = false; tick_timer_service_subscribe(MINUTE_UNIT, tick_handler); } update_time(); update_color(tick_time); }
static void gcal_event_widget_set_event_internal (GcalEventWidget *self, GcalEvent *event) { g_autofree gchar *hour_str = NULL; /* * This function is called only once, since the property is * set as CONSTRUCT_ONLY. Any other attempt to set an event * will be ignored. * * Because of that condition, we don't really have to care about * disconnecting functions or cleaning up the previous event. */ /* The event spawns with a floating reference, and we take it's ownership */ g_set_object (&self->event, event); /* * Initially, the widget's start and end dates are the same * of the event's ones. We may change it afterwards. */ gcal_event_widget_set_date_start (self, gcal_event_get_date_start (event)); gcal_event_widget_set_date_end (self, gcal_event_get_date_end (event)); /* Update color */ update_color (self); g_signal_connect_swapped (event, "notify::color", G_CALLBACK (update_color), self); g_signal_connect_swapped (event, "notify::summary", G_CALLBACK (gtk_widget_queue_draw), self); /* Tooltip */ gcal_event_widget_set_event_tooltip (self, event); /* Hour label */ hour_str = get_hour_label (self); gtk_widget_set_visible (self->hour_label, !gcal_event_get_all_day (event)); gtk_label_set_label (GTK_LABEL (self->hour_label), hour_str); /* Summary label */ g_object_bind_property (event, "summary", self->summary_label, "label", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); }
void Annotator::undo_annotation() { if(!annotation_deque_.empty()) { annotation_deque_.back()->undo(); update_color(annotation_deque_.back()->mesh_ptr(),annotation_deque_.back()->label()); annotation_deque_.pop_back(); }else { emit message(tr("No annotation in queue"),3000); } }
void reduction_entropy:: update_surfel_attributes(shared_surfel target_surfel_ptr, shared_entropy_surfel_vector const invalidated_neighbours) const { update_normal(target_surfel_ptr, invalidated_neighbours); update_color(target_surfel_ptr, invalidated_neighbours); // position needs to be updated before the radius is updated update_position(target_surfel_ptr, invalidated_neighbours); update_radius(target_surfel_ptr, invalidated_neighbours); }
static inline void set_all_red2 (wctx_t *ctx, state_info_t *state) { if (update_color(ctx, state->ref, CRED, 1)) { ctx->local->counters.allred++; if ( pins_state_is_accepting(ctx->model, state_info_state(state)) ) ctx->local->counters.accepting++; /* count accepting states */ } else { ctx->local->red.allred++; } }
static int update_color (wctx_t *ctx, ref_t ref, uint32_t color, int check) { alg_local_t *loc = ctx->local; uint32_t old = state_store_get_colors (ref) & 3; if (old >= color) return 0; int success = state_store_try_set_colors (ref, 2 + loc->rec_bits, old, color); if (!success && check) return update_color (ctx, ref, color, check); // tail-call: can happen max 3 times return success; }
void ft_impact2(t_draw_suite *val) { val->invlight = vectorscale(-1, val->lightray->d); val->kdiff = vectordot(val->invlight, val->impact->d) * MAX((val->curlight->dist - val->curobject->dist) / val->curlight->dist, 0); if (val->kdiff >= 0) { update_color(val->kdiff * 1, val->curlight->color, val->final_color, val->curobject->color); val->reflectray = rotation(val->impact->d, val->invlight); vectornorm(val->reflectray); val->kspec = vectordot(val->invlight, val->reflectray); if (val->kspec >= 0) update_color(pow(val->kspec, 20) * MAX((val->curlight->dist - val->curobject->dist) / val->curlight->dist, 0) * val->curobject->shiny, val->curlight->color, val->final_color, val->curobject->color); } }
static void endfs_handle_dangerous (wctx_t *ctx) { alg_local_t *loc = ctx->local; cndfs_alg_local_t *cloc = (cndfs_alg_local_t *) ctx->local; while ( dfs_stack_size(cloc->in_stack) ) { raw_data_t state_data = dfs_stack_pop (cloc->in_stack); state_info_deserialize (ctx->state, state_data); if ( !state_store_has_color(ctx->state->ref, GDANGEROUS, loc->rec_bits) && ctx->state->ref != loc->seed->ref ) if (update_color(ctx, ctx->state->ref, CRED, 1)) loc->red_work.explored++; } if (update_color(ctx, ctx->state->ref, CRED, 1)) { loc->red_work.explored++; loc->counters.accepting++; } if ( state_store_has_color(loc->seed->ref, GDANGEROUS, loc->rec_bits) ) { rec_ndfs_call (ctx, loc->seed->ref); } }
void change_hue(float val) { float tmp = hsv_color.h + val; if (tmp > 360) { tmp -= 360.; } else if (tmp < 0) { tmp = 360. - fabs(tmp); } hsv_color.h = tmp; rgb_color = HsvToRgb(&hsv_color); update_color(); }
void change_saturation(float val) { float tmp = hsv_color.s + val; if (tmp > 1.0) tmp = 1.; if (tmp < 0.) tmp = 0.001; hsv_color.s = tmp; rgb_color = HsvToRgb(&hsv_color); update_color(); }
void change_value(float val) { float tmp = hsv_color.v + val; if (tmp > 1.0) tmp = 1.; if (tmp < 0.) tmp = 0.; hsv_color.v = tmp; rgb_color = HsvToRgb(&hsv_color); update_color(); }
void Annotator::init(void) { uint64_t index = 0; for(std::vector<QWidget*>::iterator iter=inputs_.begin();iter!=inputs_.end();++iter) { MeshPairViewerWidget* w = (MeshPairViewerWidget*)(*iter); arma::uvec& target = labels_[index]; for(arma::uvec::iterator iter=target.begin();iter!=target.end();++iter) { updateLabel(int(*iter)); } update_color(w->first_ptr(),target); ++index; } }
void kinect_gbuffer::update(ID3D11DeviceContext* context) { if (has_new_color_) { update_color(context); } if (has_new_depth_) { update_depth(context); } // reset state has_new_depth_ = has_new_color_ = false; }
int main (int argc, char **argv) { if (wiringPiSetup () == -1) { fprintf (stdout, "oops: %s\n", strerror (errno)) ; return 1; } if (argc < 1) { fprintf(stdout, "Usage: picolord /path/to/socket"); } softPwmCreate (PIN_RED, RED_MIN, RED_MAX); softPwmCreate (PIN_GREEN, GREEN_MIN, GREEN_MAX); softPwmCreate (PIN_BLUE, BLUE_MIN, BLUE_MAX); struct sockaddr_un server; sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { perror("picolord: Error opening stream socket"); exit(1); } fcntl(sock, F_SETFL, O_NONBLOCK); server.sun_family = AF_UNIX; strcpy(server.sun_path, argv[1]); if (bind(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un))) { perror("picolord: Error binding stream socket"); exit(1); } listen(sock, 5); // Catch kill signals and ctrl+c signal(SIGINT, intHandler); signal(SIGKILL, intHandler); signal(SIGHUP, intHandler); while (keeprunning) { read_socket(); update_color(); delay(delay_time); } set_color(0,0,0); delay(100); if (sock) close(sock); unlink(argv[1]); return 0; }
void updateChannels() { if(pwm_status==POWER_ON) { pwm_enable_all(); on(DEBUGLED); } else if (pwm_status==POWER_OFF){ pwm_disable_all(); off(DEBUGLED); return; } rgb_color.r = (float) (bt_data.red) / 254.; rgb_color.g = (float) (bt_data.green) / 254.; rgb_color.b = (float)(bt_data.blue) / 254.; white_value = (uint8_t)(bt_data.white); update_color(); pwm_setdutycycle(CHAN_WHITE, white_value); }
void on_select_colors_activate(GtkMenuItem *m, gpointer data) { GtkWidget *colorsel; if(colorseldlg == NULL) { colorseldlg = gtk_color_selection_dialog_new( "Select a new color for this object"); colorsel = GTK_COLOR_SELECTION_DIALOG(colorseldlg)->colorsel; gtk_signal_connect(GTK_OBJECT(colorsel), "color_changed", (GtkSignalFunc)color_changed, (gpointer)colorsel); gtk_signal_connect_object(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG( colorseldlg) ->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), (gpointer)colorseldlg); gtk_signal_connect_object(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG( colorseldlg) ->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), (gpointer)colorseldlg); } update_color(); gtk_widget_show(colorseldlg); }
void TitleWindow::update() { title_x->update((int64_t)client->config.x); title_y->update((int64_t)client->config.y); italic->update(client->config.style & FONT_ITALIC); bold->update(client->config.style & FONT_BOLD); #ifdef USE_OUTLINE stroke->update(client->config.style & FONT_OUTLINE); #endif size->update(client->config.size); #ifndef X_HAVE_UTF8_STRING encoding->update(client->config.encoding); #endif motion->update(TitleMain::motion_to_text(client->config.motion_strategy)); loop->update(client->config.loop); dropshadow->update((float)client->config.dropshadow); fade_in->update((float)client->config.fade_in); fade_out->update((float)client->config.fade_out); #ifdef USE_OUTLINE stroke_width->update((float)client->config.stroke_width); #endif font->update(client->config.font); text->update(client->config.text.c_str()); speed->update(client->config.pixels_per_second); outline->update((int64_t)client->config.outline_size); timecode->update(client->config.timecode); char string[BCTEXTLEN]; for(int i = 0; i < sizeof(timecode_formats) / sizeof(int); i++) { if(timecode_formats[i] == client->config.timecode_format) { timecode_format->set_text( Units::print_time_format(timecode_formats[i], string)); break; } } update_justification(); update_color(); }
void Annotator::applyToPatch(void) { // std::cerr<<"applying to patch"<<std::endl; uint64_t index = 0; int label = ui->label->value(); for(std::vector<QWidget*>::iterator iter=inputs_.begin();iter!=inputs_.end();++iter) { MeshPairViewerWidget* w = (MeshPairViewerWidget*)(*iter); if(!w->first_selected().empty()) { arma::uvec& target = labels_[index]; std::vector<arma::uword>::iterator e = w->first_selected().end(); std::vector<arma::uword> selected_patch; selected_patch.reserve(w->first_selected().size()); for(std::vector<arma::uword>::iterator iter=w->first_selected().begin();iter!=e;++iter) { selected_patch.push_back( target(*iter) ); } std::sort(selected_patch.begin(),selected_patch.end()); selected_patch.erase(std::unique(selected_patch.begin(),selected_patch.end()),selected_patch.end()); arma::uvec indices = arma::find(target==selected_patch.front()); for(std::vector<arma::uword>::iterator iter = selected_patch.begin()+1 ; iter!=selected_patch.end() ; ++iter ) { indices = arma::join_rows(indices,arma::find(target==*iter)); } w->first_selected().clear(); annotation_deque_.emplace_back(new Annotation(indices,label,w->first_ptr(),target)); annotation_deque_.back()->apply(); if( annotation_deque_.size() > max_queue_size_ ) { annotation_deque_.pop_front(); } update_color(w->first_ptr(),target); QApplication::processEvents(); } ++index; } }
void Annotator::applyToPoint(void) { uint64_t index = 0; int label = ui->label->value(); for(std::vector<QWidget*>::iterator iter=inputs_.begin();iter!=inputs_.end();++iter) { MeshPairViewerWidget* w = (MeshPairViewerWidget*)(*iter); if(!w->first_selected().empty()) { arma::uvec& target = labels_[index]; arma::uvec indices(w->first_selected()); w->first_selected().clear(); annotation_deque_.emplace_back(new Annotation(indices,label,w->first_ptr(),target)); annotation_deque_.back()->apply(); if( annotation_deque_.size() > max_queue_size_ ) { annotation_deque_.pop_front(); } update_color(w->first_ptr(),target); QApplication::processEvents(); } ++index; } }
/** * Compute derived GL state. * If __GLcontextRec::NewState is non-zero then this function \b must * be called before rendering anything. * * Calls dd_function_table::UpdateState to perform any internal state * management necessary. * * \sa _mesa_update_modelview_project(), _mesa_update_texture(), * _mesa_update_buffer_bounds(), * _mesa_update_lighting() and _mesa_update_tnl_spaces(). */ void _mesa_update_state_locked( GLcontext *ctx ) { GLbitfield new_state = ctx->NewState; GLbitfield prog_flags = _NEW_PROGRAM; GLbitfield new_prog_state = 0x0; if (new_state == _NEW_CURRENT_ATTRIB) goto out; if (MESA_VERBOSE & VERBOSE_STATE) _mesa_print_state("_mesa_update_state", new_state); /* Determine which state flags effect vertex/fragment program state */ if (ctx->FragmentProgram._MaintainTexEnvProgram) { prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR | _NEW_ARRAY); } if (ctx->VertexProgram._MaintainTnlProgram) { prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT | _NEW_FOG | _NEW_LIGHT | _MESA_NEW_NEED_EYE_COORDS); } /* * Now update derived state info */ if (new_state & prog_flags) update_program_enables( ctx ); if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) _mesa_update_modelview_project( ctx, new_state ); if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) _mesa_update_texture( ctx, new_state ); if (new_state & _NEW_BUFFERS) _mesa_update_framebuffer(ctx); if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) _mesa_update_draw_buffer_bounds( ctx ); if (new_state & _NEW_POLYGON) update_polygon( ctx ); if (new_state & _NEW_LIGHT) _mesa_update_lighting( ctx ); if (new_state & (_NEW_STENCIL | _NEW_BUFFERS)) _mesa_update_stencil( ctx ); #if FEATURE_pixel_transfer if (new_state & _MESA_NEW_TRANSFER_STATE) _mesa_update_pixel( ctx, new_state ); #endif if (new_state & _DD_NEW_SEPARATE_SPECULAR) update_separate_specular( ctx ); if (new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) update_arrays( ctx ); if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT)) update_viewport_matrix(ctx); if (new_state & _NEW_MULTISAMPLE) update_multisample( ctx ); if (new_state & _NEW_COLOR) update_color( ctx ); #if 0 if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR)) update_tricaps( ctx, new_state ); #endif /* ctx->_NeedEyeCoords is now up to date. * * If the truth value of this variable has changed, update for the * new lighting space and recompute the positions of lights and the * normal transform. * * If the lighting space hasn't changed, may still need to recompute * light positions & normal transforms for other reasons. */ if (new_state & _MESA_NEW_NEED_EYE_COORDS) _mesa_update_tnl_spaces( ctx, new_state ); if (new_state & prog_flags) { /* When we generate programs from fixed-function vertex/fragment state * this call may generate/bind a new program. If so, we need to * propogate the _NEW_PROGRAM flag to the driver. */ new_prog_state |= update_program( ctx ); } out: new_prog_state |= update_program_constants(ctx); /* * Give the driver a chance to act upon the new_state flags. * The driver might plug in different span functions, for example. * Also, this is where the driver can invalidate the state of any * active modules (such as swrast_setup, swrast, tnl, etc). * * Set ctx->NewState to zero to avoid recursion if * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?) */ new_state = ctx->NewState | new_prog_state; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); ctx->Array.NewState = 0; }
int TitleWindow::resize_event(int w, int h) { client->config.window_w = w; client->config.window_h = h; clear_box(0, 0, w, h); font_title->reposition_window(font_title->get_x(), font_title->get_y()); font->reposition_window(font->get_x(), font->get_y()); font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y()); x_title->reposition_window(x_title->get_x(), x_title->get_y()); title_x->reposition_window(title_x->get_x(), title_x->get_y()); y_title->reposition_window(y_title->get_x(), y_title->get_y()); title_y->reposition_window(title_y->get_x(), title_y->get_y()); style_title->reposition_window(style_title->get_x(), style_title->get_y()); italic->reposition_window(italic->get_x(), italic->get_y()); bold->reposition_window(bold->get_x(), bold->get_y()); #ifdef USE_OUTLINE stroke->reposition_window(stroke->get_x(), stroke->get_y()); #endif size_title->reposition_window(size_title->get_x(), size_title->get_y()); size->reposition_window(size->get_x(), size->get_y()); #ifndef X_HAVE_UTF8_STRING encoding_title->reposition_window(encoding_title->get_x(), encoding_title->get_y()); encoding->reposition_window(encoding->get_x(), encoding->get_y()); #endif color_button->reposition_window(color_button->get_x(), color_button->get_y()); #ifdef USE_OUTLINE color_stroke_button->reposition_window(color_stroke_button->get_x(), color_stroke_button->get_y()); #endif outline_color_button->reposition_window(outline_color_button->get_x(), outline_color_button->get_y()); motion_title->reposition_window(motion_title->get_x(), motion_title->get_y()); motion->reposition_window(motion->get_x(), motion->get_y()); loop->reposition_window(loop->get_x(), loop->get_y()); dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y()); dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y()); fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y()); fade_in->reposition_window(fade_in->get_x(), fade_in->get_y()); fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y()); fade_out->reposition_window(fade_out->get_x(), fade_out->get_y()); text_title->reposition_window(text_title->get_x(), text_title->get_y()); #ifdef USE_OUTLINE stroke_width->reposition_window(stroke_width->get_x(), stroke_width->get_y()); strokewidth_title->reposition_window(strokewidth_title->get_x(), strokewidth_title->get_y()); #endif timecode->reposition_window(timecode->get_x(), timecode->get_y()); text->reposition_window(text->get_x(), text->get_y(), w - text->get_x() - 10, BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10)); justify_title->reposition_window(justify_title->get_x(), justify_title->get_y()); left->reposition_window(left->get_x(), left->get_y()); center->reposition_window(center->get_x(), center->get_y()); right->reposition_window(right->get_x(), right->get_y()); top->reposition_window(top->get_x(), top->get_y()); mid->reposition_window(mid->get_x(), mid->get_y()); bottom->reposition_window(bottom->get_x(), bottom->get_y()); speed_title->reposition_window(speed_title->get_x(), speed_title->get_y()); speed->reposition_window(speed->get_x(), speed->get_y()); update_color(); flash(); return 1; }
void TitleWindow::create_objects() { int x = 10, y = 10; int margin = client->get_theme()->widget_border; char string[BCTEXTLEN]; #define COLOR_W 50 #define COLOR_H 30 client->build_fonts(); client->build_previews(this); encodings.append(new BC_ListBoxItem("ISO8859-1")); encodings.append(new BC_ListBoxItem("ISO8859-2")); encodings.append(new BC_ListBoxItem("ISO8859-3")); encodings.append(new BC_ListBoxItem("ISO8859-4")); encodings.append(new BC_ListBoxItem("ISO8859-5")); encodings.append(new BC_ListBoxItem("ISO8859-6")); encodings.append(new BC_ListBoxItem("ISO8859-7")); encodings.append(new BC_ListBoxItem("ISO8859-8")); encodings.append(new BC_ListBoxItem("ISO8859-9")); encodings.append(new BC_ListBoxItem("ISO8859-10")); encodings.append(new BC_ListBoxItem("ISO8859-11")); encodings.append(new BC_ListBoxItem("ISO8859-12")); encodings.append(new BC_ListBoxItem("ISO8859-13")); encodings.append(new BC_ListBoxItem("ISO8859-14")); encodings.append(new BC_ListBoxItem("ISO8859-15")); encodings.append(new BC_ListBoxItem("KOI8")); encodings.append(new BC_ListBoxItem("UTF-8")); sizes.append(new BC_ListBoxItem("8")); sizes.append(new BC_ListBoxItem("9")); sizes.append(new BC_ListBoxItem("10")); sizes.append(new BC_ListBoxItem("11")); sizes.append(new BC_ListBoxItem("12")); sizes.append(new BC_ListBoxItem("13")); sizes.append(new BC_ListBoxItem("14")); sizes.append(new BC_ListBoxItem("16")); sizes.append(new BC_ListBoxItem("18")); sizes.append(new BC_ListBoxItem("20")); sizes.append(new BC_ListBoxItem("22")); sizes.append(new BC_ListBoxItem("24")); sizes.append(new BC_ListBoxItem("26")); sizes.append(new BC_ListBoxItem("28")); sizes.append(new BC_ListBoxItem("32")); sizes.append(new BC_ListBoxItem("36")); sizes.append(new BC_ListBoxItem("40")); sizes.append(new BC_ListBoxItem("48")); sizes.append(new BC_ListBoxItem("56")); sizes.append(new BC_ListBoxItem("64")); sizes.append(new BC_ListBoxItem("72")); sizes.append(new BC_ListBoxItem("100")); sizes.append(new BC_ListBoxItem("128")); sizes.append(new BC_ListBoxItem("256")); sizes.append(new BC_ListBoxItem("512")); sizes.append(new BC_ListBoxItem("1024")); paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION))); paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP))); paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM))); paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT))); paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT))); // Construct font list for(int i = 0; i < client->fonts->size(); i++) { int exists = 0; for(int j = 0; j < fonts.size(); j++) { if(!strcasecmp(fonts.get(j)->get_text(), client->fonts->get(i)->fixed_title)) { exists = 1; break; } } BC_ListBoxItem *item = 0; if(!exists) { fonts.append(item = new BC_ListBoxItem(client->fonts->get(i)->fixed_title)); if(!strcmp(client->config.font, item->get_text())) item->set_selected(1); if(client->fonts->values[i]->image) { VFrame *vframe = client->fonts->get(i)->image; BC_Pixmap *icon = new BC_Pixmap(this, vframe, PIXMAP_ALPHA); item->set_icon(icon); item->set_icon_vframe(vframe); } } } // Sort font list int done = 0; while(!done) { done = 1; for(int i = 0; i < fonts.size() - 1; i++) { if(strcmp(fonts.values[i]->get_text(), fonts.values[i + 1]->get_text()) > 0) { BC_ListBoxItem *temp = fonts.values[i + 1]; fonts.values[i + 1] = fonts.values[i]; fonts.values[i] = temp; done = 0; } } } add_tool(font_title = new BC_Title(x, y, _("Font:"))); font = new TitleFont(client, this, x, y + font_title->get_h()); font->create_objects(); x += font->get_w() + margin; add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y + 20)); x += font_tumbler->get_w() + margin; add_tool(size_title = new BC_Title(x, y, _("Size:"))); sprintf(string, "%d", client->config.size); size = new TitleSize(client, this, x, y + 20, string); size->create_objects(); x += size->get_w() + margin; add_subwindow(size_tumbler = new TitleSizeTumble(client, this, x, y + 20)); x += size_tumbler->get_w() + margin; add_tool(style_title = new BC_Title(x, y, _("Style:"))); add_tool(italic = new TitleItalic(client, this, x, y + 20)); add_tool(bold = new TitleBold(client, this, x, y + 50)); #ifdef USE_OUTLINE add_tool(stroke = new TitleStroke(client, this, x, y + 80)); #endif x += 90; add_tool(justify_title = new BC_Title(x, y, _("Justify:"))); add_tool(left = new TitleLeft(client, this, x, y + 20)); add_tool(center = new TitleCenter(client, this, x, y + 50)); add_tool(right = new TitleRight(client, this, x, y + 80)); x += 80; add_tool(top = new TitleTop(client, this, x, y + 20)); add_tool(mid = new TitleMid(client, this, x, y + 50)); add_tool(bottom= new TitleBottom(client, this, x, y + 80)); y += 50; x = 10; add_tool(x_title = new BC_Title(x, y, _("X:"))); title_x = new TitleX(client, this, x, y + 20); title_x->create_objects(); x += 90; add_tool(y_title = new BC_Title(x, y, _("Y:"))); title_y = new TitleY(client, this, x, y + 20); title_y->create_objects(); x += 90; add_tool(motion_title = new BC_Title(x, y, _("Motion type:"))); motion = new TitleMotion(client, this, x, y + 20); motion->create_objects(); x += 150; add_tool(loop = new TitleLoop(client, x, y + 20)); x += 100; x = 10; y += 50; add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:"))); dropshadow = new TitleDropShadow(client, this, x, y + 20); dropshadow->create_objects(); x += 100; add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):"))); add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20)); x += 100; add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):"))); add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20)); x += 110; add_tool(speed_title = new BC_Title(x, y, _("Speed:"))); speed = new TitleSpeed(client, this, x, y + 20); speed->create_objects(); x += 110; color_x = x; color_y = y + 20; x += COLOR_W + 5; add_tool(color_button = new TitleColorButton(client, this, x, y + 20, 0)); x += color_button->get_w(); color_thread = new TitleColorThread(client, this, 0); x = color_x; y += 50; outline_color_x = x; outline_color_y = y + 20; x += COLOR_W + 5; add_tool(outline_color_button = new TitleColorButton(client, this, x, y + 20, 1)); x += outline_color_button->get_w(); outline_color_thread = new TitleColorThread(client, this, 1); x = 10; // y += 50; add_tool(outline_title = new BC_Title(x, y, _("Outline:"))); outline = new TitleOutline(client, this, x, y + outline_title->get_h() + margin); outline->create_objects(); x += outline->get_w() + margin; #ifndef X_HAVE_UTF8_STRING add_tool(encoding_title = new BC_Title(x, y + 3, _("Encoding:"))); encoding = new TitleEncoding(client, this, x, y + encoding_title->get_h() + margin); encoding->create_objects(); x += 100; #endif y += outline_title->get_h() + margin; add_tool(timecode = new TitleTimecode(client, x, y)); x += timecode->get_w() + margin; add_tool(timecode_format = new TitleTimecodeFormat( client, x, y, Units::print_time_format(client->config.timecode_format, string))); for(int i = 0; i < sizeof(timecode_formats) / sizeof(int); i++) { timecode_format->add_item(new BC_MenuItem( Units::print_time_format(timecode_formats[i], string))); } x = 10; y += timecode_format->get_h() + margin; add_tool(text_title = new BC_Title(x, y + 3, _("Text:"))); x = 10; y += text_title->get_h() + margin; text = new TitleText(client, this, x, y, get_w() - x - 10, get_h() - y - 10); text->create_objects(); update_color(); show_window(1); }