TableofcontentsMenuItem::TableofcontentsMenuItem (
                            const gnote::Note::Ptr & note,
                            const Glib::ustring    & heading,
                            Heading::Type            heading_level,
                            int                      heading_position)
  : m_note            (note)
  , m_heading_position (heading_position)
{
  //Create a new menu item, with style depending on the heading level:
  /* +-----------------+
     |[] NOTE TITLE    | <---- Title     == note icon  + bold note title
     | > Heading 1     | <---- Level_1   == arrow icon + heading title
     | > Heading 1     |
     |   → heading 2   | <---- Level_2   == (no icon)  + indent string + heading title
     |   → heading 2   |
     |   → heading 2   |
     | > Heading 1     |
     +-----------------+
   */

  set_use_underline (false); //we don't want potential '_' in the heading to be used as mnemonic

  if (heading_level == Heading::Title) {
    set_image(*manage(new Gtk::Image(gnote::IconManager::obj().get_icon(gnote::IconManager::NOTE, 16))));
    Gtk::Label *label = (Gtk::Label*)get_child();
    label->set_markup("<b>" + heading + "</b>");
  }
  else if (heading_level == Heading::Level_1) {
    set_image(*manage(new Gtk::Image(Gtk::Stock::GO_FORWARD, Gtk::ICON_SIZE_MENU)));
    set_label(heading);
  }
  else if (heading_level == Heading::Level_2) {
    set_label("→  " + heading);
  }
}
示例#2
0
  void test_serde() {
    // dynamic create message.
    MessageHelper helper;
    FileDescriptorProto file_proto;
    file_proto.set_name("test.proo");
    DescriptorProto *message_proto = file_proto.add_message_type();
    message_proto->set_name("Pair");
    auto field = message_proto->add_field();
    field->set_name("key");
    field->set_label(FieldDescriptorProto_Label_LABEL_REQUIRED);
    field->set_type(FieldDescriptorProto_Type_TYPE_STRING);
    field->set_number(1);

    field = message_proto->add_field();
    field->set_name("value");
    field->set_label(FieldDescriptorProto_Label_LABEL_REQUIRED);
    field->set_type(FieldDescriptorProto_Type_TYPE_BYTES);
    field->set_number(2);
    helper.registerDynamicMessage(file_proto);
    auto src = helper.createMessage("Pair");
    auto ref = src->GetReflection();
    string key("scott");
    string value("tiger");
    ref->SetString(src.get(), src->GetDescriptor()->FindFieldByName("key"), key);
    ref->SetString(src.get(), src->GetDescriptor()->FindFieldByName("value"), value);

    // test serde
    check_serde_str(src.get(), helper.createMessage("Pair").get());
    check_serde_array(src.get(), helper.createMessage("Pair").get());
    check_serstr_dearray(src.get(), helper.createMessage("Pair").get());
    check_serarray_destr(src.get(), helper.createMessage("Pair").get());
  }
示例#3
0
static void
swap_labels(struct coloring *c, int a, int b)
{
	int tmp = c->lab[a];
	set_label(c, a, c->lab[b]);
	set_label(c, b, tmp);
}
示例#4
0
void generate_for(component init, component condition, component next,
		  component iteration, const char *continue_label,
		  bool discard, fncode fn)
{
  struct whiledata wdata;

  env_block_push(NULL); /* init may have local declarations */
  if (init)
    generate_component(init, NULL, TRUE, fn);

  start_block(NULL, FALSE, discard, fn);
  wdata.continue_label = continue_label;
  wdata.looplab = new_label(fn);
  wdata.mainlab = new_label(fn);
  wdata.endlab = new_label(fn);
  wdata.code = iteration;
  wdata.next = next;

  set_label(wdata.looplab, fn);
  if (condition)
    {
      generate_condition(condition, wdata.mainlab, wmain_code, &wdata,
			 wdata.endlab, NULL, NULL, fn);
      set_label(wdata.endlab, fn);
      if (!discard)
	generate_component(component_undefined, NULL, FALSE, fn);
    }
  else
    wmain_code(&wdata, fn);
  end_block(fn);
  env_block_pop();
}
示例#5
0
文件: generate.c 项目: BluePanM/code
static void
generate_while_statement(DVM_Executable *exe, Block *block,
                         Statement *statement, OpcodeBuf *ob)
{
    int loop_label;
    WhileStatement *while_s = &statement->u.while_s;

    loop_label = get_label(ob);
    set_label(ob, loop_label);

    generate_expression(exe, block, while_s->condition, ob);

    while_s->block->parent.statement.break_label = get_label(ob);
    while_s->block->parent.statement.continue_label = get_label(ob);

    generate_code(ob, statement->line_number,
                  DVM_JUMP_IF_FALSE,
                  while_s->block->parent.statement.break_label);
    generate_statement_list(exe, while_s->block,
                            while_s->block->statement_list, ob);

    set_label(ob, while_s->block->parent.statement.continue_label);
    generate_code(ob, statement->line_number, DVM_JUMP, loop_label);
    set_label(ob, while_s->block->parent.statement.break_label);
}
示例#6
0
int AthScan::scale_axis()
{
    qint32 minFreq = ui->minFreqSpinBox->value();
    qint32 maxFreq = (minFreq > ui->maxFreqSpinBox->value()) ?  minFreq + 20 : ui->maxFreqSpinBox->value();
    qint32 minPwr = ui->minPwrSpinBox->value();
    qint32 maxPwr = (minPwr > ui->maxPwrSpinBox->value()) ?  minPwr + 2 : ui->maxPwrSpinBox->value();
    quint32 x_border = (minFreq + maxFreq) / 2;
    qint32 y_border = (minPwr + maxPwr) / 2;

    _borderV->setValue(x_border, y_border);
    QString xlabel;
    xlabel.sprintf("%dMHz", x_border);
    set_label(_borderV, xlabel);
    _borderH->setValue(x_border, y_border);
    QString ylabel;
    ylabel.sprintf("%ddb", y_border);
    set_label(_borderH, ylabel);

    ui->fftPlot->setAxisScale(QwtPlot::xBottom, minFreq, maxFreq);
    ui->fftPlot->setAxisScale(QwtPlot::yLeft, minPwr, maxPwr, 4);

    ui->fftPlot->replot();

    return 0;
}
示例#7
0
static void edit_find_ok_callback(read_direction_t direction, Widget w, XtPointer context, XtPointer info)
{ /* "Find" is the label here */
  char *str = NULL, *buf = NULL;
  XmString s1;
  XEN proc;
  str = XmTextGetString(edit_find_text);
  if ((str) && (*str))
    { 
      clear_global_search_procedure(true);
      ss->search_expr = mus_strdup(str);
      redirect_errors_to(errors_to_find_text, NULL);
      proc = snd_catch_any(eval_str_wrapper, str, str);
      redirect_errors_to(NULL, NULL);
      if ((XEN_PROCEDURE_P(proc)) && (procedure_arity_ok(proc, 1)))
	{
	  ss->search_proc = proc;
	  ss->search_proc_loc = snd_protect(proc);
#if HAVE_SCHEME
	  if (optimization(ss) > 0)
	    ss->search_tree = mus_run_form_to_ptree_1_b(XEN_PROCEDURE_SOURCE(proc));
#endif
	  buf = (char *)calloc(PRINT_BUFFER_SIZE, sizeof(char));
	  mus_snprintf(buf, PRINT_BUFFER_SIZE, "find: %s", str);
	  set_label(edit_find_label, buf);
	  /* XmTextSetString(edit_find_text, NULL); */
	  free(buf);
	}
    }
  else
    {
      if (ss->search_expr == NULL)
	{
	  char *temp = NULL;
	  /* using global search_proc set by user */
	  buf = (char *)calloc(PRINT_BUFFER_SIZE, sizeof(char));
	  mus_snprintf(buf, PRINT_BUFFER_SIZE, "find: %s", temp = (char *)XEN_AS_STRING(ss->search_proc));
#if HAVE_SCHEME
	  if (temp) free(temp);
#endif
	  set_label(edit_find_label, buf);
	  /* XmTextSetString(edit_find_text, NULL); */
	  free(buf);
	}
    }
  if (str) XtFree(str);
  if ((XEN_PROCEDURE_P(ss->search_proc)) || (ss->search_tree))
    {
      s1 = XmStringCreateLocalized((char *)"Stop");
      XtVaSetValues(cancelB, XmNlabelString, s1, NULL);
      XmStringFree(s1);
      redirect_xen_error_to(stop_search_if_error, NULL);
      str = global_search(direction);
      redirect_xen_error_to(NULL, NULL);
      s1 = XmStringCreateLocalized((char *)"Go Away");
      XtVaSetValues(cancelB, XmNlabelString, s1, NULL);
      XmStringFree(s1);
      if ((str) && (*str)) set_label(edit_find_label, str);
    }
} 
static void update_ipv6(void)
{
	const struct connman_ipv6 *ipv6, *ipv6_conf;
	gboolean method_set = FALSE;
	gboolean privacy_set = FALSE;
	char value[6];

	ipv6 = connman_service_get_ipv6(path);
	ipv6_conf = connman_service_get_ipv6_config(path);

	if (ipv6 == NULL) {
		set_entry(builder, "ipv6_address", "", "");
		set_entry(builder, "ipv6_prefix_length", "", "");
		set_entry(builder, "ipv6_gateway", "", "");

		goto config;
	}

	memset(value, 0, 6);
	snprintf(value, 6, "%u", ipv6->prefix);

	set_ipv6_method(ipv6->method);
	method_set = TRUE;

	set_label(builder, "ipv6_address", ipv6->address, "");
	set_label(builder, "ipv6_prefix_length", value, "");
	set_label(builder, "ipv6_gateway", ipv6->gateway, "");

	set_ipv6_privacy(ipv6->privacy);
	privacy_set = TRUE;

config:
	if (ipv6_conf == NULL) {
		set_entry(builder, "ipv6_conf_address", "", "");
		set_entry(builder, "ipv6_conf_prefix_length", "", "");
		set_entry(builder, "ipv6_conf_gateway", "", "");

		if (ipv6 == NULL)
			set_widget_sensitive(builder, "ipv6_settings", FALSE);

		return;
	}

	memset(value, 0, 6);
	snprintf(value, 6, "%u", ipv6_conf->prefix);

	if (method_set == FALSE)
		set_ipv6_method(ipv6_conf->method);

	set_entry(builder, "ipv6_conf_address", ipv6_conf->address, "");
	set_entry(builder, "ipv6_conf_prefix_length", value, "");
	set_entry(builder, "ipv6_conf_gateway", ipv6_conf->gateway, "");

	if (privacy_set == FALSE)
		set_ipv6_privacy(ipv6_conf->privacy);
}
static void
set_label_from_settings (EmpathyIrcNetworkChooser *self)
{
  EmpathyIrcNetworkChooserPriv *priv = GET_PRIV (self);
  const gchar *server;

  tp_clear_object (&priv->network);

  server = empathy_account_settings_get_string (priv->settings, "server");

  if (server != NULL)
    {
      EmpathyIrcServer *srv;
      gint port;
      gboolean ssl;

      priv->network = empathy_irc_network_manager_find_network_by_address (
          priv->network_manager, server);

      if (priv->network != NULL)
        {
          /* The network is known */
          g_object_ref (priv->network);
          set_label (self);
          return;
        }

      /* We don't have this network. Let's create it */
      port = empathy_account_settings_get_uint32 (priv->settings, "port");
      ssl = empathy_account_settings_get_boolean (priv->settings,
          "use-ssl");

      DEBUG ("Create a network %s", server);
      priv->network = empathy_irc_network_new (server);
      srv = empathy_irc_server_new (server, port, ssl);

      empathy_irc_network_append_server (priv->network, srv);
      empathy_irc_network_manager_add (priv->network_manager, priv->network);

      set_label (self);

      g_object_unref (srv);
      return;
    }

  /* Set default network */
  priv->network = empathy_irc_network_manager_find_network_by_address (
          priv->network_manager, DEFAULT_IRC_NETWORK);
  g_assert (priv->network != NULL);

  set_label (self);
  update_server_params (self);
  g_object_ref (priv->network);
}
示例#10
0
void update_game_values()
{
	char dummy[20] = "";

	sprintf(dummy,"%lu",current_score);
	set_label(score_label2,dummy);
	sprintf(dummy,"%d",current_level);
	set_label(level_label2,dummy);
	sprintf(dummy,"%d",current_lines);
	set_label(lines_label2,dummy);
}
示例#11
0
static void update_header(void)
{
	GdkPixbuf *image = NULL;
	const char *type, *info;
	GtkWidget *widget;
	gboolean favorite;

	type = connman_service_get_type(path);
	if (g_strcmp0(type, "wifi") == 0) {
		uint8_t strength;

		strength = connman_service_get_strength(path);

		cui_theme_get_signal_icone_and_info(strength, &image, &info);
	} else
		cui_theme_get_type_icone_and_info(type, &image, &info);

	set_image(builder, "service_type", image, info);
	set_label(builder, "service_name",
			connman_service_get_name(path), "- Hidden -");

	if (connman_service_is_connected(path) == TRUE)
		cui_theme_get_state_icone_and_info(
				connman_service_get_state(path), &image, &info);
	else
		image = NULL;

	set_image(builder, "service_state", image, info);
	set_label(builder, "service_error",
				connman_service_get_error(path), "");

	favorite = connman_service_is_favorite(path);

	set_button_toggle(builder, "service_autoconnect",
				connman_service_is_autoconnect(path));
	widget = set_widget_sensitive(builder,
				"service_autoconnect", favorite);
	if (favorite == TRUE) {
		g_signal_connect(widget, "toggled",
				G_CALLBACK(autoconnect_button_toggled), NULL);
	}

	set_button_toggle(builder, "service_favorite", favorite);
	widget = set_widget_sensitive(builder, "service_favorite", favorite);

	if (favorite == TRUE) {
		g_signal_connect(widget, "toggled",
				G_CALLBACK(favorite_button_toggled), NULL);
	}
}
示例#12
0
文件: snd-gregion.c 项目: huangjs/cl
static void make_region_labels(file_info *hdr)
{
  char *str;
  if (hdr == NULL) return;
  str = (char *)CALLOC(PRINT_BUFFER_SIZE, sizeof(char));
  mus_snprintf(str, PRINT_BUFFER_SIZE, _("srate: %d"), hdr->srate);
  set_label(srate_text, str);
  mus_snprintf(str, PRINT_BUFFER_SIZE, _("chans: %d"), hdr->chans);
  set_label(chans_text, str);
  mus_snprintf(str, PRINT_BUFFER_SIZE, _("length: %.3f"), (float)((double)(hdr->samples) / (float)(hdr->chans * hdr->srate)));
  set_label(length_text, str);
  mus_snprintf(str, PRINT_BUFFER_SIZE, _("maxamp: %.3f"), region_maxamp(region_list_position_to_id(current_region)));
  set_label(maxamp_text, str);
  FREE(str);
}
示例#13
0
文件: gpio.c 项目: 0s4l/u-boot-xlnx
int gpio_request(unsigned gpio, const char *label)
{
	if (check_gpio(gpio) < 0)
		return -EINVAL;

	/*
	 * Allow that the identical GPIO can
	 * be requested from the same driver twice
	 * Do nothing and return -
	 */

	if (cmp_label(gpio, label) == 0)
		return 0;

	if (unlikely(is_reserved(gpio, gpio, 1))) {
		printf("bfin-gpio: GPIO %d is already reserved by %s !\n",
		       gpio, get_label(gpio));
		return -EBUSY;
	}
	if (unlikely(is_reserved(peri, gpio, 1))) {
		printf("bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
		       gpio, get_label(gpio));
		return -EBUSY;
	}
	else {	/* Reset POLAR setting when acquiring a gpio for the first time */
		set_gpio_polar(gpio, 0);
	}

	reserve(gpio, gpio);
	set_label(gpio, label);

	port_setup(gpio, GPIO_USAGE);

	return 0;
}
示例#14
0
文件: gpio.c 项目: 0s4l/u-boot-xlnx
int special_gpio_request(unsigned gpio, const char *label)
{
	/*
	 * Allow that the identical GPIO can
	 * be requested from the same driver twice
	 * Do nothing and return -
	 */

	if (cmp_label(gpio, label) == 0)
		return 0;

	if (unlikely(is_reserved(special_gpio, gpio, 1))) {
		printf("bfin-gpio: GPIO %d is already reserved by %s !\n",
		       gpio, get_label(gpio));
		return -EBUSY;
	}
	if (unlikely(is_reserved(peri, gpio, 1))) {
		printf("bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
		       gpio, get_label(gpio));

		return -EBUSY;
	}

	reserve(special_gpio, gpio);
	reserve(peri, gpio);

	set_label(gpio, label);
	port_setup(gpio, GPIO_USAGE);

	return 0;
}
示例#15
0
文件: NodeView.cpp 项目: EQ4/lad
NodeView::NodeView(Gtk::Window*                        window,
                   Ganv::Canvas&                       canvas,
                   SPtr<machina::client::ClientObject> node,
                   double                              x,
                   double                              y)
	: Ganv::Circle(canvas, "", x, y)
	, _window(window)
	, _node(node)
	, _default_border_color(get_border_color())
	, _default_fill_color(get_fill_color())
{
	set_fit_label(false);
	set_radius_ems(1.25);

	signal_event().connect(sigc::mem_fun(this, &NodeView::on_event));

	MachinaCanvas* mcanvas = dynamic_cast<MachinaCanvas*>(&canvas);
	if (is(mcanvas->app()->forge(), URIs::instance().machina_initial)) {
		set_border_width(4.0);
		set_is_source(true);
		const uint8_t alpha[] = { 0xCE, 0xB1, 0 };
		set_label((const char*)alpha);
	}

	node->signal_property.connect(sigc::mem_fun(this, &NodeView::on_property));

	for (const auto& p : node->properties()) {
		on_property(p.first, p.second);
	}
}
示例#16
0
文件: NodeView.cpp 项目: EQ4/lad
void
NodeView::show_label(bool show)
{
	if (show && _enter_action) {
		Atom note_number = _enter_action->get(
			URIs::instance().machina_note_number);
		if (note_number.is_valid()) {
			uint8_t buf[8];
			midi_note_name(note_number.get<int32_t>(), buf);
			set_label((const char*)buf);
			return;
		}
	}

	set_label("");
}
bookmark_menu_item::bookmark_menu_item(Gtk::RadioButtonGroup& _group, int _line, std::string _filename)
: Gtk::RadioMenuItem(_group),filename(_filename)
{
    line = _line;
    set_label(filename+" "+ integer_to_string(line));
    set_active(false);
    }
示例#18
0
文件: codegen.c 项目: ras52/bootstrap
static
named_label(name, is_defn) {
    if ( save_label( name, 0 ) )
        return set_label( name, new_label() );
    else
        return get_label( name );
}
示例#19
0
void RTinitPoptMPI(int *argc_p,char**argv_p[],const struct poptOption * options,
	int min_args,int max_args,char*args[],
	const char* pgm_prefix,const char* arg_help,const char* extra_help
){
	MPI_Init(argc_p,argv_p);
	MPI_Errhandler_set(MPI_COMM_WORLD,MPI_ERRORS_ARE_FATAL);
	if (atexit(check_auto_abort)){
		Fatal(1,error,"atexit failed");
	}
	int mpi_nodes;
	int mpi_me;
	MPI_Comm_size(MPI_COMM_WORLD, &mpi_nodes);
        MPI_Comm_rank(MPI_COMM_WORLD, &mpi_me);
	if (mpi_me==0) {
		auto_abort=2;
		RTinitPopt(argc_p,argv_p,options,min_args,max_args,args,pgm_prefix,arg_help,extra_help);
		auto_abort=1;
	}
	int stop=0;
	int global=0;
	MPI_Allreduce(&stop,&global,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
	if (global) {
		RTfiniMPI();
		MPI_Finalize();
		exit(EXIT_SUCCESS);
	}
	if (mpi_me) {
		RTinitPopt(argc_p,argv_p,options,min_args,max_args,args,pgm_prefix,arg_help,extra_help);
		set_label("%s(%2d/%2d)",get_label(),mpi_me,mpi_nodes);
	}
}
static void
dialog_response_cb (GtkDialog *dialog,
    gint response,
    EmpathyIrcNetworkChooser *self)
{
  EmpathyIrcNetworkChooserPriv *priv = GET_PRIV (self);
  EmpathyIrcNetworkChooserDialog *chooser =
    EMPATHY_IRC_NETWORK_CHOOSER_DIALOG (priv->dialog);

  if (response != GTK_RESPONSE_CLOSE &&
      response != GTK_RESPONSE_DELETE_EVENT)
    return;

  if (empathy_irc_network_chooser_dialog_get_changed (chooser))
    {
      tp_clear_object (&priv->network);

      priv->network = g_object_ref (
          empathy_irc_network_chooser_dialog_get_network (chooser));

      update_server_params (self);
      set_label (self);

      g_signal_emit (self, signals[SIG_CHANGED], 0);
    }

  gtk_widget_destroy (priv->dialog);
  priv->dialog = NULL;
}
示例#21
0
PlayerView::PlayerView ( GameModel *model, GameController *controller, int id ) : 
                            model_ (model), 
                            controller_ (controller),
                            playerId_ (id) {
  
  std::stringstream ss;
  ss << playerId_+1;
  set_label ("Player " + ss.str());
  set_label_align( Gtk::ALIGN_CENTER, Gtk::ALIGN_TOP );
  set_shadow_type( Gtk::SHADOW_ETCHED_OUT );

  add (vBox_);

  pLabel_.set_text ("0");
  pointsLabel_.set_text ("points");
  pointsBox_.add (pLabel_);
  pointsBox_.add (pointsLabel_);

  dLabel_.set_text ("0");
  discardsLabel_.set_text ("discards");
  discardsBox_.add (dLabel_);
  discardsBox_.add (discardsLabel_);

  joinButton_.set_label ("Join Game");
  joinButton_.signal_clicked().connect( sigc::mem_fun( *this, &PlayerView::onJoinButtonClick ) );

  vBox_.add (pointsBox_);
  vBox_.add (discardsBox_);
  vBox_.add (joinButton_);

  show_all();

}
示例#22
0
CheckButton::CheckButton(Glib::ustring const &label, Glib::ustring const &tooltip, bool active)
{
    set_use_underline (true);
    set_label (label);
    set_tooltip_text(tooltip);
    set_active(active);
}
示例#23
0
void tcontrol::set_members(const string_map& data)
{
	/** @todo document this feature on the wiki. */
	/** @todo do we need to add the debug colors here as well? */
	string_map::const_iterator itor = data.find("id");
	if(itor != data.end()) {
		set_id(itor->second);
	}

	itor = data.find("linked_group");
	if(itor != data.end()) {
		set_linked_group(itor->second);
	}

	itor = data.find("label");
	if(itor != data.end()) {
		set_label(itor->second);
	}

	itor = data.find("tooltip");
	if(itor != data.end()) {
		set_tooltip(itor->second);
	}

	itor = data.find("help");
	if(itor != data.end()) {
		set_help_message(itor->second);
	}

	itor = data.find("use_markup");
	if(itor != data.end()) {
		set_use_markup(utils::string_bool(itor->second));
	}
}
示例#24
0
void entity::set_distinct_label()
{
	//generate a random label for the object
	char buf[64];
	sprintf(buf, "_%x", rand());
	set_label(buf);
}
示例#25
0
button::button(CVideo& video, const std::string& label, button::TYPE type,
               std::string button_image_name, SPACE_CONSUMPTION spacing, const bool auto_join)
	: widget(video, auto_join), type_(type), label_(label),
	  image_(NULL), pressedImage_(NULL), activeImage_(NULL), pressedActiveImage_(NULL),
	  button_(true), state_(NORMAL), pressed_(false),
	  spacing_(spacing), base_height_(0), base_width_(0)
{
	if(button_image_name.empty() && type == TYPE_PRESS) {
		button_image_name = "button";
	} else if(button_image_name.empty() && type == TYPE_CHECK) {
		button_image_name = "checkbox";
	}

	const std::string button_image_file = "buttons/" + button_image_name + ".png";
	surface button_image(image::get_image(button_image_file));
	surface pressed_image(image::get_image("buttons/" + button_image_name + "-pressed.png"));
	surface active_image(image::get_image("buttons/" + button_image_name + "-active.png"));
	surface pressed_active_image;

	if (pressed_image.null())
		pressed_image.assign(button_image);

	if (active_image.null())
		active_image.assign(button_image);

	if (type == TYPE_CHECK) {
		pressed_active_image.assign(image::get_image("buttons/" + button_image_name + "-active-pressed.png"));
		if (pressed_active_image.null())
			pressed_active_image.assign(pressed_image);
	}

	if (button_image.null()) {
		ERR_DP << "error initializing button!\n";
		throw error();
	}

	base_height_ = button_image->h;
	base_width_ = button_image->w;

	if (type_ != TYPE_IMAGE){
		set_label(label);
	}

	if(type == TYPE_PRESS) {
		image_.assign(scale_surface(button_image,location().w,location().h));
		pressedImage_.assign(scale_surface(pressed_image,location().w,location().h));
		activeImage_.assign(scale_surface(active_image,location().w,location().h));
	} else {
		image_.assign(scale_surface(button_image,button_image->w,button_image->h));
		pressedImage_.assign(scale_surface(pressed_image,button_image->w,button_image->h));
		activeImage_.assign(scale_surface(active_image,button_image->w,button_image->h));
		if (type == TYPE_CHECK)
			pressedActiveImage_.assign(scale_surface(pressed_active_image, button_image->w, button_image->h));
	}

	if (type_ == TYPE_IMAGE){
		calculate_size();
	}
}
示例#26
0
文件: compile.c 项目: MUME/mudlle
static void wmain_code(void *_data, fncode fn)
{
  struct whiledata *wdata = _data;

  set_label(wdata->mainlab, fn);
  generate_component(wdata->code, fn);
  branch(op_loop1, wdata->looplab, fn);
}
示例#27
0
文件: compile.c 项目: MUME/mudlle
static void wexit_code(void *_data, fncode fn)
{
  struct whiledata *wdata = _data;

  set_label(wdata->exitlab, fn);
  generate_component(component_undefined, fn);
  branch(op_branch1, wdata->endlab, fn);
  adjust_depth(-1, fn);
}
示例#28
0
文件: compile.c 项目: MUME/mudlle
static void generate_while(component condition, component iteration, fncode fn)
{
  struct whiledata wdata;

  wdata.looplab = new_label(fn);
  wdata.mainlab = new_label(fn);
  wdata.exitlab = new_label(fn);
  wdata.endlab = new_label(fn);
  wdata.code = iteration;

  env_start_loop();
  set_label(wdata.looplab, fn);
  generate_condition(condition, wdata.mainlab, wmain_code, &wdata,
		     wdata.exitlab, wexit_code, &wdata, fn);
  set_label(wdata.endlab, fn);
  env_end_loop();
  adjust_depth(1, fn);
}
示例#29
0
文件: gpio.c 项目: 0s4l/u-boot-xlnx
int peripheral_request(unsigned short per, const char *label)
{
	unsigned short ident = P_IDENT(per);

	/*
	 * Don't cares are pins with only one dedicated function
	 */

	if (per & P_DONTCARE)
		return 0;

	if (!(per & P_DEFINED))
		return -ENODEV;

	BUG_ON(ident >= MAX_RESOURCES);

	/* If a pin can be muxed as either GPIO or peripheral, make
	 * sure it is not already a GPIO pin when we request it.
	 */
	if (unlikely(!check_gpio(ident) && is_reserved(gpio, ident, 1))) {
		printf("%s: Peripheral %d is already reserved as GPIO by %s !\n",
		       __func__, ident, get_label(ident));
		return -EBUSY;
	}

	if (unlikely(is_reserved(peri, ident, 1))) {

		/*
		 * Pin functions like AMC address strobes my
		 * be requested and used by several drivers
		 */

		if (!(per & P_MAYSHARE)) {
			/*
			 * Allow that the identical pin function can
			 * be requested from the same driver twice
			 */

			if (cmp_label(ident, label) == 0)
				goto anyway;

			printf("%s: Peripheral %d function %d is already reserved by %s !\n",
			       __func__, ident, P_FUNCT2MUX(per), get_label(ident));
			return -EBUSY;
		}
	}

 anyway:
	reserve(peri, ident);

	portmux_setup(per);
	port_setup(ident, PERIPHERAL_USAGE);

	set_label(ident, label);

	return 0;
}
示例#30
0
Node3D::Node3D(int index, int symbol, QColor color, int size)
{
    set_index(index);
    set_coordinates(_random(), _random(), _random());
    set_size(1);
    set_marked(false);
    set_selected(false);
    set_label("");
}