コード例 #1
0
/*--------------------------------------------------------------------
 * output_viewer::clear
 *
 */
void
output_viewer::clear()
{
  current_file = empty_file;

  delete outtree;
  outtree = 0;
  text->clear();

  update_infobar();
}
コード例 #2
0
/*--------------------------------------------------------------------
 * src_viewer::create_window
 *
 */
void src_viewer::create_window() {
  inherited::create_window();

  infobar = new vmessage( toplevel );
  annote_column = text->add_column( 4 );
  current_file_name = no_source_file;

  create_file_menu();
  update_infobar();

  show( vman->get_selection() );
}
コード例 #3
0
/*--------------------------------------------------------------------
 * output_viewer::create_window
 */
void
output_viewer::create_window()
{
  inherited::create_window();
  infobar = new vmessage(toplevel);

  /* menu */
  binding *b = new binding( (bfun) &do_open_cmd, this );
  menu->add_command( b, "File", "Open Output File ..." );
  add_close_command( menu, "File" );

  update_infobar();

  show( vman->get_selection() );
}
コード例 #4
0
/*--------------------------------------------------------------------
 * src_viewer::print_source
 */
bool src_viewer::print_source() {
  text->clear();

  if ( current_file_name == no_source_file) {
    text->fout() << "No source file for file_block found\n";
  } else {
    String pathname =
          suif_utils::get_path( current_file_block ) + current_file_name;
    /* read and insert file */
    if ( text->insert_file( (char *)pathname.c_str(), true ) ) {
      text->fout() << "Cannot find source file " << pathname.c_str() << endl;
    } else {
      return true;
    }
  }
 
  current_file_name = no_source_file;
  update_infobar();
  text->update();
  return false;
}
コード例 #5
0
/*--------------------------------------------------------------------
 * output_viewer::view
 *
 */
void
output_viewer::view(FileBlock* fb, String out_file)
{
  if (!current_fse || current_fse != fb) {
    clear();

    if ( out_file.is_empty()) {
      out_file = suif_utils::get_source_file( fb );
      out_file.truncate_to_last('.');
      out_file = out_file + "_gen.c";
      // out_file = suif_utils::get_source_file( fb ) + String(".out_c.c");
    }

    if ( fb ) {
      current_fse = fb;
      out_file = suif_utils::get_path( fb ) + out_file;
    }
    print_output( out_file );
    current_file = out_file;
    update_infobar();
  }
}
コード例 #6
0
/*--------------------------------------------------------------------
 * src_viewer::view
 *
 */
void src_viewer::view(FileBlock* fb, String file_name ) {
  if ( fb && ( fb != current_file_block ) || 
             ( !file_name.is_empty() && file_name != current_file_name ) ) {
    current_file_block = fb;

    if ( file_name.is_empty() ) {
      file_name = suif_utils::get_source_file( fb );
    }

    current_file_name = file_name;

    if ( print_source() ) {

      /* check cache */
      stree = 0;
      for ( s_count_t _cnt=0; _cnt<stree_cache->size(); _cnt++ ) {
        code_tree* ct = (*stree_cache)[_cnt];
        source_id* s_id = (source_id*)ct->id;
        if ( (*s_id) == source_id( current_file_block, current_file_name ) ) {
	      stree = ct;
              break;
        }
      }

      if ( !stree ) {
        build_stree();
      }

     /* annotate the source codes */
     annotate_src();

     /* create tags */
     stree->create_tags( text );
    }
  }
  update_infobar();
}
コード例 #7
0
ファイル: viewer.cpp プロジェクト: jemartti/Cubes
bool Viewer::on_expose_event( GdkEventExpose* /*event*/ )
{
	Glib::RefPtr<Gdk::GL::Drawable> gldrawable = get_gl_drawable();

	if ( !gldrawable )
	{
		return false;
	}

	if ( !gldrawable->gl_begin(get_gl_context()) )
	{
		return false;
	}

	// Start drawing
	draw_init( get_width(), get_height() );

	// Transform the world gnomon
	for( int i = 0; i < 4; i += 1 )
	{
		m_gnomonTrans[i] = m_viewing * m_gnomon[i];
	}
	// Draw the world gnomon
	set_colour( Colour(0.1, 0.1, 1.0) );
	draw_line2D( m_gnomonTrans[0], m_gnomonTrans[1] );
	draw_line2D( m_gnomonTrans[0], m_gnomonTrans[2] );
	draw_line2D( m_gnomonTrans[0], m_gnomonTrans[3] );

	// Draw the modelling gnomon
	set_colour( Colour(0.1, 1.0, 0.1) );
	draw_modellingGnomon();

	// Draw the unit cube
	set_colour( Colour(0.1, 0.1, 0.1) );
	draw_unitCube();

	// Initialize the viewport
	if ( !m_viewflag )
	{
		m_viewport[0] = ( Point2D(get_width() * 0.05, get_height() * 0.05) );
		m_viewport[1] = ( Point2D(get_width() * 0.95, get_height() * 0.05) );
		m_viewport[2] = ( Point2D(get_width() * 0.95, get_height() * 0.95) );
		m_viewport[3] = ( Point2D(get_width() * 0.05, get_height() * 0.95) );
		m_viewflag    = true;
	}
	// Draw the viewport
	set_colour( Colour(0.1, 0.1, 0.1) );
	draw_line( m_viewport[0], m_viewport[1] );
	draw_line( m_viewport[1], m_viewport[2] );
	draw_line( m_viewport[2], m_viewport[3] );
	draw_line( m_viewport[3], m_viewport[0] );

	// Finish drawing
	draw_complete();

	// Update the information bar
	update_infobar();

	// Swap the contents of the front and back buffers so we see what we
	// just drew. This should only be done if double buffering is enabled.
	gldrawable->swap_buffers();

	gldrawable->gl_end();

	return true;
}