当前位置: 首页>>代码示例>>C++>>正文


C++ Fl_Text_Buffer类代码示例

本文整理汇总了C++中Fl_Text_Buffer的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Text_Buffer类的具体用法?C++ Fl_Text_Buffer怎么用?C++ Fl_Text_Buffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Fl_Text_Buffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Timer_CB

static void Timer_CB(void *data)                // timer callback
{
    if(enable_timer==1)
    {
        Fl_Text_Buffer* buf;
        buf=new Fl_Text_Buffer();

        char text[1024];
        if(count_min<=0)
            sprintf(text,"Time elapsed : %d Secs",count_sec);
        else
        {
            if(count_min==1)
                sprintf(text,"Time elapsed : %d min , %d Secs",count_min,count_sec);
            else
                sprintf(text,"Time elapsed : %d mins , %d Secs",count_min,count_sec);
        }

        buf->text(text);
        count_sec=count_sec+1;
        if(count_sec>=60)
        {
            count_sec=0;
            count_min=count_min+1;
        }
        clock1->buffer(buf);
    }
    Fl::repeat_timeout(1, Timer_CB, data);
    //}
}
开发者ID:Assassin0028,项目名称:RC_Practice_Desktop_App,代码行数:30,代码来源:main.cpp

示例2: create_about_tab

void create_about_tab(int x, int y, int w, int h)
{
  int              border;
  Fl_Text_Display *ptext;
  Fl_Text_Buffer  *pbuff;

  Fl_Group *group1 = new Fl_Group(x, y, w, h, "About");
  {
    border = 10;
    ptext = new Fl_Text_Display(x + border, y + border, w - 3 * border, h - 3 * border);
    pbuff = new Fl_Text_Buffer();
    ptext->buffer(pbuff);
    ptext->textcolor(fl_rgb_color(85, 170, 255));
    ptext->color(fl_rgb_color(8, 7, 5));
    pbuff->text("\n"
		" BMS manager Feb 2016.\n"
		" Part of SombreroBMS (battery management system)\n"
		" Copyright 2016 Patrick Xavier Areny\n"
		"\n"
		"\n"
		" Used libraries:\n"
		"\n"
		"  Tinyxml    \tLee Thomason\n"
		"  FLTK       \twww.fltk.org\n"
		"  OpenGl     \tKhronos group\n"
		"\n"
		"\n"
		" Used font: "
		"\n"
		"\n"
		" VeraMono ttf, Bitstream, Inc.\n"
		"\n");
  }
  group1->end();
}
开发者ID:mandraga,项目名称:SombreroBms,代码行数:35,代码来源:about_tab.cpp

示例3: help_button_cb

void help_button_cb( Fl_Widget* o, void*)
{
    const char* title = "help_dockbar.txt";

    // get file content
    string content = "";
    string line;
    ifstream ifs (title);
    if (ifs.is_open())
    {
        while ( getline (ifs,line) )
        {
            content += line + "\n";
        }
        ifs.close();
    }
    else cerr<<"Unable to open file"<<endl;

    // create window
    Fl_Window *help_win = new Fl_Window(border_space + button_size + border_space,
        100, //border_space + button_size + border_space,
        screen_width / 2 + 10,
        screen_height / 4 + 10 ,
        title);

    Fl_Text_Display *help_display = new Fl_Text_Display(
        5,5, screen_width / 2 , screen_height / 4  );

    Fl_Text_Buffer *buff = new Fl_Text_Buffer();
    buff->append(content.c_str() ); // add content to buffer
    help_display->buffer(buff); // register buffer
    help_win->add(help_display);

    help_win->show();
}
开发者ID:Beloumi,项目名称:Silidock,代码行数:35,代码来源:Main_Window.cpp

示例4: SPADES_MARK_FUNCTION

		void Runner::RunProtected() {
			SPADES_MARK_FUNCTION();
			std::string err;
			try{
				Run();
			}catch(const spades::Exception& ex){
				err = ex.GetShortMessage();
				SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
			}catch(const std::exception& ex){
				err = ex.what();
				SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
			}
			if(!err.empty()){
				ErrorDialog dlg;
				dlg.set_modal();
				dlg.result = 0;
				
				// TODO: free this buffer (just leaking)
				Fl_Text_Buffer *buf = new Fl_Text_Buffer;
				buf->append(err.c_str());
				dlg.infoView->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
				dlg.infoView->buffer(buf);
				dlg.helpView->value("See SystemMessages.log for more details.");
				dlg.show();
				while(dlg.visible()){
					Fl::wait();
				}
			}
		}
开发者ID:logalog64,项目名称:openspades,代码行数:29,代码来源:Runner.cpp

示例5: cb_save

void text_editor::cb_save(Fl_Widget *widget, void *v)
{
	extern std::list<std::string> whitelist;

	text_editor *editor = (text_editor*)v;
	Fl_Text_Buffer *buffer = editor->buffer;
	
	int buff_length = buffer->length();
	int buff_lines = buffer->count_lines(0, buff_length);
	
	if (buff_lines > 0)
	{
		int pos = 0;
		whitelist.clear();
		
		for (int i = 0; i <= buff_lines; i++)
		{
			char* line_text = buffer->line_text(pos);
			std::string line(line_text);
			free(line_text);

			if(line.length() > 3)
				whitelist.push_back(line);

			pos = min(buffer->line_end(pos) + 1, buff_length);
		}
	}

	editor->hide();
}
开发者ID:KrossX,项目名称:Insomnia,代码行数:30,代码来源:insomnia_gui.cpp

示例6: GetCustomButtonText

void ModelViewController::GetCustomButtonText(int nr)
{
	string Text = ProcessControl.CustomButtonGcode[nr];

	Fl_Text_Buffer* buffer = gui->CustomButtonText->buffer();
	buffer->text(Text.c_str());
	gui->CustomButtonLabel->value(ProcessControl.CustomButtonLabel[nr].c_str());
	Fl::check();
}
开发者ID:McNeight,项目名称:repsnapper,代码行数:9,代码来源:modelviewcontroller.cpp

示例7: rkWindow

InfoWindow::InfoWindow(int W, int H, const char *l) : rkWindow(W,H,l)
{
	begin();
	display = new Fl_Text_Display(INFO_MARGIN,INFO_MARGIN,W-(INFO_MARGIN*3),H-INFO_MARGIN*3,0);
	display->wrap_mode(3,0);
	Fl_Text_Buffer *b = new Fl_Text_Buffer();
	b->insert(0, InfoWindow::info);
	display->buffer(b);
	end();
}
开发者ID:Encapsulate,项目名称:CCCheat,代码行数:10,代码来源:InfoWindow.cpp

示例8: putChordInTextBox

/*************************************************************************************
** Function: putChordInTextBox
** Description: Create current scale and write it to fullscale c string, pass
**				fullscale to buffer and print to display text box.
*************************************************************************************/
void putChordInTextBox(Fl_Widget * o, void *v){
	//Get the chord based on the chord meu and chord root menu selections
	//using the ScaleWindow's scale object
	((ScaleWindow*)v)->getChord(((ScaleWindow*)v)->chordMenu->value(), ((ScaleWindow*)v)->chordRootMenu->value());
	//Prepare the text with fullscale c-string and the buffer
	Fl_Text_Buffer *buffer = new Fl_Text_Buffer();
	buffer->text(((ScaleWindow *)v)->fullscale);
	//Print the buffer
	((ScaleWindow*)v)->out->buffer(buffer);
}
开发者ID:PrestonFrom,项目名称:Scales4All,代码行数:15,代码来源:ScaleWindow.cpp

示例9: serial_handler

static void
serial_handler(
	int			fd,
	void *			user_arg
)
{

	char			line[ 256 ];
	int			    len;

    if (serial_fd==0) 
        return;

	if( !read_char_line( serial_fd, line, sizeof(line) ) )
	{
		perror( "read_char" );
		return;
	}

	len = strlen( line );
	line[len++] = '\n';
	line[len] = '\0';

    if (gui->pause_raw_output->value()!=1) {
        gui->raw_serial_output->insert(line);
        Fl_Text_Buffer *textBuffer = gui->raw_serial_output->buffer();
        int numLines = textBuffer->count_lines(0, textBuffer->length());
        gui->raw_serial_output->scroll(numLines, 0);

        // ugly way to keep the buffer from growing unchecked
        if (numLines > 1000) {
            textBuffer->remove(0, (textBuffer->length()-100));
        }
    }

	if( strncmp( line, "$GPADC", 6 ) == 0 )
	{
	    imu_samples++;
        update_adc(line);
	} else

	if( strncmp( line, "$GPPPM", 6 ) == 0 )
	{
        update_ppm(line);
	} else

    {
		// Ignore the line for now
	}

}
开发者ID:anjdreas,项目名称:Helicopter-Autopilot-Simulator,代码行数:51,代码来源:main.cpp

示例10: putScaleInTextBox

/*************************************************************************************
** Function: putScaleInTextBox
** Description: Create current scale and write it to fullscale c string, pass
**				fullscale to buffer and print to display text box.
*************************************************************************************/
void putScaleInTextBox(Fl_Widget * o, void *v){
	//Get the scale using the ScaleWindow's scale object
	((ScaleWindow*)v)->getScale(((ScaleWindow*)v)->modeMenu->value(), ((ScaleWindow*)v)->rootMenu->value());
	//Get a buffer so we can print in the display box
	Fl_Text_Buffer *buffer = new Fl_Text_Buffer();
	//Set the buffer to use the fullscale char string
	buffer->text(((ScaleWindow *)v)->fullscale);
	//Print the buffer
	((ScaleWindow*)v)->out->buffer(buffer);
	//Reset the chrord root menu and chord menu selections to zero
	((ScaleWindow*)v)->chordRootMenu->value(0);	
	((ScaleWindow*)v)->chordMenu->value(0);
	((ScaleWindow*)v)->scale.clearCurrentChord();
}
开发者ID:PrestonFrom,项目名称:Scales4All,代码行数:19,代码来源:ScaleWindow.cpp

示例11: send_to_editor_cb

static void send_to_editor_cb(Fl_Widget*, void *s) {
	ObjectTree *self = (ObjectTree*)s;
	Fl_Tree_Item *titem = self->first_selected_item();

	if(!titem || !titem->user_data()) return;

	Entity *en = (Entity*)titem->user_data();
	Fl_Text_Buffer *ebuf = self->get_editor_buffer();

	E_RETURN_IF_FAIL(ebuf != NULL);

	char buf[EDELIB_DBUS_EXPLORER_DEFAULT_SCRIPT_EVAL_BUFSIZE];
	if(en->get_prototype_as_scheme(buf, sizeof(buf)))
		ebuf->append(buf);
}
开发者ID:GustavoMOG,项目名称:edelib,代码行数:15,代码来源:ObjectTree.cpp

示例12: SaveCustomButton

void ModelViewController::SaveCustomButton()
{
	int ButtonNr = gui->CustomButtonSelectorSlider->value()-1;

	Fl_Text_Buffer* buffer = gui->CustomButtonText->buffer();
	char* pText = buffer->text();
	string Text = string(pText);
	free(pText);
	ProcessControl.CustomButtonGcode[ButtonNr] = Text;

	const char* text = gui->CustomButtonLabel->value();
	string label(text);
	ProcessControl.CustomButtonLabel[ButtonNr] = label;

	RefreshCustomButtonLabels();
}
开发者ID:McNeight,项目名称:repsnapper,代码行数:16,代码来源:modelviewcontroller.cpp

示例13: SPADES_MARK_FUNCTION

//lm: this doesnt really belong here, should be somewhere in core or client probably?
//	we might need to introduce some base object that will handle global state and whatnot..
//	now all windows just spawn eachother, instead of being managed from a central place.
void MainWindow::StartGame(const spades::ServerAddress &host) {
	SPADES_MARK_FUNCTION();
	
	//hide();
	
#if 0
	SDLRunner r(host);
	r.Run();
#else
	std::string err;
	try{
		if(cg_smp){
			SDLAsyncRunner r(host, cg_playerName);
			r.Run();
		}else{
			SDLRunner r(host, cg_playerName);
			r.Run();
		}
	}catch(const spades::Exception& ex){
		err = ex.GetShortMessage();
		SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
	}catch(const std::exception& ex){
		err = ex.what();
		SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
	}
	if(!err.empty()){
		ErrorDialog dlg;
		dlg.set_modal();
		dlg.result = 0;
		
		// TODO: free this buffer (just leaking)
		Fl_Text_Buffer *buf = new Fl_Text_Buffer;
		buf->append(err.c_str());
		dlg.infoView->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
		dlg.infoView->buffer(buf);
		dlg.helpView->value("See SystemMessages.log for more details.");
		dlg.show();
		while(dlg.visible()){
			Fl::wait();
		}
		if( dlg.result == 1 ){
			//show();
		}
	}
#endif
}
开发者ID:aaroneusthegreat,项目名称:openspades,代码行数:49,代码来源:MainWindowHandler.cpp

示例14: init

void ModelViewController::init()
{

	Fl_Text_Buffer* buffer = gui->GCodeStart->buffer();
	buffer->text(ProcessControl.GCodeStartText.c_str());
	buffer = gui->GCodeLayer->buffer();
	buffer->text(ProcessControl.GCodeLayerText.c_str());
	buffer = gui->GCodeEnd->buffer();
	buffer->text(ProcessControl.GCodeEndText.c_str());
    //buffer->text(ProcessControl.Notes.c_str());

	buffer = gui->LuaScriptEditor->buffer();
	buffer->text("--Clear existing gcode\nbase:ClearGcode()\n-- Set start speed for acceleration firmware\nbase:AddText(\"G1 F2600\\n\")\n\n	 z=0.0\n	 e=0;\n	oldx = 0;\n	oldy=0;\n	while(z<47) do\n	angle=0\n		while (angle < math.pi*2) do\n	x=(50*math.cos(z/30)*math.sin(angle))+70\n		y=(50*math.cos(z/30)*math.cos(angle))+70\n\n		--how much to extrude\n\n		dx=oldx-x\n		dy=oldy-y\n		if not (angle==0) then\n			e = e+math.sqrt(dx*dx+dy*dy)\n			end\n\n			-- Make gcode string\n\n			s=string.format(\"G1 X%f Y%f Z%f F2600 E%f\\n\", x,y,z,e)\n			if(angle == 0) then\n				s=string.format(\"G1 X%f Y%f Z%f F2600 E%f\\n\", x,y,z,e)\n				end\n				-- Add gcode to gcode result\nbase:AddText(s)\n	 angle=angle+0.2\n	 oldx=x\n	 oldy=y\n	 end\n	 z=z+0.4\n	 end\n	 ");

	//	buffer = gui->CommunationsLogText->buffer();
//	buffer->text("Dump");
}
开发者ID:McNeight,项目名称:repsnapper,代码行数:17,代码来源:modelviewcontroller.cpp

示例15: WriteGCode

void ModelViewController::WriteGCode (string filename)
{
  Fl_Text_Buffer* buffer = gui->GCodeResult->buffer();
  int result = buffer->savefile (filename.c_str());

  switch (result)
    {
    case 0: // Succes
      break;
    case 1: // Open for write failed
      fl_alert ("Error saving GCode file, error creating file.");
      break;
    case 2: // Partially saved file
      fl_alert ("Error saving GCode file, while writing file, is the disk full?.");
      break;
    }
}
开发者ID:McNeight,项目名称:repsnapper,代码行数:17,代码来源:modelviewcontroller.cpp


注:本文中的Fl_Text_Buffer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。