/**
 * @brief Receives a key press event.
 *
 * This overrides the implementation of QPlainTextEdit to block the built-in
 * undo/redo actions and use our own ones instead, to pass through the
 * QUndoStack.
 *
 * @param event The event to handle.
 */
void TextEditorWidget::keyPressEvent(QKeyEvent* event) {

  if (event == QKeySequence::Undo) {
    undo_stack.undo();
    event->accept();
    return;
  }

  if (event == QKeySequence::Redo) {
    undo_stack.redo();
    event->accept();
    return;
  }

  if (event->key() == Qt::Key_Tab) {
    insert_tab();
    event->accept();
    return;
  }

  if (event->key() == Qt::Key_Backtab) {
    remove_tab();
    event->accept();
    return;
  }

  QPlainTextEdit::keyPressEvent(event);
}
Ejemplo n.º 2
0
int		suppr(t_cursor *cursor, char **_tab)
{
  if (smth_to_rm(cursor, _tab) != 1)
    return (0);
  remove_tab(cursor, _tab);
  cursor->select = 0;
  cursor->l = 0;
  return (1);
}
Ejemplo n.º 3
0
/**
 * gtr_notebook_remove_page:
 * @notebook: a #GtrNotebook
 * @page_num: the index of a notebook page, starting from 0.
 *
 * Removes a page from the notebook given its index in the notebook.
 */
void
gtr_notebook_remove_page (GtrNotebook * notebook, gint page_num)
{
  GtrTab *tab;

  g_return_if_fail (GTR_IS_NOTEBOOK (notebook));

  tab = GTR_TAB (gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num));

  remove_tab (tab, notebook);
}
Ejemplo n.º 4
0
/**
 * cedit_notebook_remove_tab:
 * @nb: a #CeditNotebook
 * @tab: a #CeditTab
 *
 * Removes @tab from @nb.
 */
void
cedit_notebook_remove_tab (CeditNotebook *nb,
			   CeditTab      *tab)
{
	gint position, curr;

	g_return_if_fail (CEDIT_IS_NOTEBOOK (nb));
	g_return_if_fail (CEDIT_IS_TAB (tab));

	/* Remove the page from the focused pages list */
	nb->priv->focused_pages =  g_list_remove (nb->priv->focused_pages,
						  tab);

	position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
	curr = gtk_notebook_get_current_page (GTK_NOTEBOOK (nb));

	if (position == curr)
	{
		smart_tab_switching_on_closure (nb, tab);
	}

	remove_tab (tab, nb);
}
Ejemplo n.º 5
0
// you may want to have a look into /usr/src/linux/drivers/char/console.c
void parse_character(termstate_t * term, l4_uint8_t c)
{
    int i;

    // these must be handled independetly of state
    switch (c)
    {
    case 0: // ignore
        return;
    case 7: // bell
        // todo: impl. me
        return;
    case 8: // backspace
        if (term->cur_x > 0)
            term->cur_x--;
        return;
    case 9: // tab
        cursor_tab(term);
        return;
    case 10: // newline (lf)
    case 11: // ?
    case 12: // ?
        cursor_nl(term);
        return;
    case 13: // do a cr here, maybe a smart one (+ lf)
        cursor_cr(term);
        return;
    case 27: // ESC
        term->esc_state = ESesc;
        return;
    }

    // now check for the state-dependant characters
    switch (term->esc_state)
    {
    case ESnormal:
        // normal character
        if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xfe))
        {
            if (term->insert_mode == VT100_INSMODE_REPLACE)
            {
                set_char(term, c);
                //vt100_redraw_xy(term, term->cur_x, term->cur_y);
                cursor_next(term);
            }
            else // VT100_INSMODE_INSERT
            {
                insert_char(term, c);
                //vt100_redraw(term);
            }
            return;
        }
//        switch (c)
//        {
//        }
        break;
    case ESesc: // normal ESC found
        term->esc_state = ESnormal;
        switch (c)
        {
        case '[':
            term->esc_state = ESsquare;
            return;
        case 'D':  // lf
            cursor_lf(term);
            //vt100_redraw(term);
            return;
        case 'E':  // cr + lf
            cursor_nl(term);
            //vt100_redraw(term);
            return;
        case 'H':  // set tab at current position
            set_tab( term, term->cur_x );
            return;
        case 'M':
            rev_scroll(term);
            //vt100_redraw(term);
            return;
        case '7':  // save cursor position and attributes
            term->cur_stored_x    = term->cur_x;
            term->cur_stored_y    = term->cur_y;
            term->cur_stored_attr = term->attrib_mode;
            return;
        case '8':  // restore saved cursor position and attributes
            term->cur_x         = term->cur_stored_x;
            term->cur_y         = term->cur_stored_y;
            term->attrib_mode   = term->cur_stored_attr;
            return;
        case '#':
            term->esc_state = EShash;
            return;
        case 'c':  // reset vt to default settings
            init_termstate(term, term->w, term->phys_h, term->virt_h);
            return;
        }
    case ESsquare:
        for(i = 0; i < NUM_PAR; i++)
            term->par[i] = 0;
        term->used_par = 0;
        term->esc_state = ESgetpars;
        term->ques = (c=='?');
        if (term->ques)
            return;
        // fall-through
    case ESgetpars:
        if (c == ';' && term->used_par < NUM_PAR - 1)
        {
            term->used_par++;
            return;
        }
        else if (c >= '0' && c <= '9')
        {
            term->par[term->used_par] *= 10;
            term->par[term->used_par] += c - '0';
            return;
        } else term->esc_state = ESgotpars;
        // fall-through
    case ESgotpars:
        term->esc_state = ESnormal;
        switch (c)
        {
        case 'h':
            if (term->ques)
            {
                // handle question commands ending with h
                for (i = 0; i <= term->used_par; i++)
                {
                    switch( term->par[i] )
                    {
                    case  5: // activate inverse screen
                        if (set_mode(term, 1))
                            //vt100_redraw(term);
                        break;
                    case  6: // origin mode = scroll region
                        term->origin_mode = VT100_ORIGIN_SCROLL;
                        break;
                    case  7: // autowrap mode on
                        term->autowrap   = 1;
                        break;
                    case  8: // autorepeat on
                        term->autorepeat = 1;
                        break;
                    case 25: // activate cursor
                        term->cursor_vis = 1; return;
                    default:
                        break;
                    }
                }
                return;
            }
            else // handle commands without question mark
            {
                for(i = 0; i <= term->used_par; i++)
                {
                    switch( term->par[i] )
                    {
                    case 4: // insert mode on
                        term->insert_mode = VT100_INSMODE_INSERT;
                        break;
                    case 12: // echo on
                        term->echo = 1;
                        break;
                    case 20: // line feed mode
                        term->newline = 1;
                        break;
                    default: break;
                    }
                }
                return;
            }
        case 'l':
            if (term->ques)
            {
                for(i = 0; i <= term->used_par; i++)
                {
                    // handle question commands ending with l
                    switch( term->par[i] )
                    {
                    case  3: // set 80 column mode, clear screen
                        // todo: impl. resize and use it here
                        break;
                    case  5: // deactivate inverse screen
                        if(set_mode(term, 0))
                            //vt100_redraw(term);
                        break;
                    case  6: // origin mode = whole screen
                        term->origin_mode = VT100_ORIGIN_GLOBAL;
                    case  7: // autowrap mode off
                        term->autowrap = 0;
                        break;
                    case  8: // autorepeat off
                        term->autorepeat = 0;
                        break;
                    case 25: // deactivate cursor
                        term->cursor_vis = 0; return;
                    default: break;
                    }
                    return;
                }
            }
            else // handle commands without question mark
            {
                for( i=0; i <= term->used_par; i++ )
                {
                    switch( term->par[i] )
                    {
                    case 4: // insert mode off
                        term->insert_mode = VT100_INSMODE_REPLACE;
                        break;
                    case 12: // echo off
                        term->echo = 0;
                        break;
                    case 20: // carriage return mode
                        term->newline = 0;
                        break;
                    default:
                        break;
                    }
                    return;
                }
            }
        }
        if (term->ques)
        {
            term->ques = 0;
            return;
        }
        switch (c)
        {
        case 'F':  // CR + up
            term->cur_x     = 0;
            // fall through
        case 'A':  // up
            if (! term->par[0])
                term->par[0]++;
            cursor_up(term);
            return;
        case 'E':  // CR + down
            term->cur_x     = 0;
            // fall through
        case 'B':  // down
            if (! term->par[0])
                term->par[0]++;
            cursor_down(term);
            return;
        case 'C':  // right
            // no parameter -> set parameter to default (=1)
            if (! term->par[0])
                term->par[0]++;
            cursor_right(term);
            return;
        case 'D':  // left
            if (! term->par[0])
                term->par[0]++;
            cursor_left(term);
            return;
        case 'G':  // cursor position horizontal absolute
            if ( (term->par[0] > 0) &&
                 (term->par[0] < term->w) )
                term->cur_x = term->par[0];
            return;
        case 'H':  // absolute position (x,y)
        case 'f':  // f is the same as H (correct me, if I'm wrong)
            // well it is the same in the Linux kernel, in theorie the
            // 'f' commands depend on the PUM (Position unit mode),
            // which can be characters (seems to be default) or inch
            if (term->par[0] > 0)  // convert to (0, 0) based coords
                term->par[0]--;
            if (term->par[1] > 0)
                term->par[1]--;
            cursor_move_abs(term, term->par[1], term->par[0]);
            return;
        case 'I':  // insert tabs ('\t', term->par[0] times)
            if (!term->par[0])
                term->par[0]++;
            for (i=0;i<term->par[0];i++)
                cursor_tab(term);
            return;
        case 'J':
            switch(term->par[0])
            {
            case 0:  // kill to end of screen
                clean_to_eos(term);
                //vt100_redraw(term);
                return;
            case 1:  // kill from start of screen
                clean_from_sos(term);
                //vt100_redraw(term);
                return;
            case 2:  // kill whole screen
                clean_screen(term, ' ');
                //vt100_redraw(term);
                return;
            }
        case 'K':  // kill to end of line
            switch(term->par[0])
            {
            case 0: // clean to end of line
                clean_to_eol(term);
                //vt100_redraw(term);
                return;
            case 1: // clean from start of line
                clean_from_sol(term);
                return;
            case 2: // erase whole line
                clean_line(term, term->cur_y);
                return;
            }
        case 'L':  // insert lines
            if (!term->par[0])
                term->par[0] = 1;
            for (i=0; i<term->par[0]; i++)
                insert_line(term);
            //vt100_redraw(term);
            return;
        case 'M':  // erase lines
            if (!term->par[0])
                term->par[0] = 1;
            for (i=0; i<term->par[0]; i++)
                erase_line(term);
            //vt100_redraw(term);
            return;
        case 'c':  // we were asked to identify the terminal type
            identify(term);
            return;
        case 'g':  // erase tab(s)
            switch(term->par[0])
            {
                case 0:  remove_tab( term, term->cur_x );
                         break;
                case 3:  clear_tabs( term );
                         break;
                default: break;
            }
            return;
        case 'm':
            csi_m(term);
            return;
        case 'r':  // set scrolling region
            if (term->par[0] == 0)
                term->par[0]++;
            if (term->par[1] == 0)
                term->par[1] = term->phys_h;
            /* Minimum allowed region is 2 lines */
            if (term->par[0] < term->par[1] &&
                term->par[1] <= term->phys_h)
            {
                term->scroll_top = term->par[0] - 1;
                term->scroll_bottom = term->par[1]; // this line is excluded
                // if in origin mode, make sure that the cursor is placed
                // inside the scrolling region immediately
                if (term->origin_mode == VT100_ORIGIN_SCROLL)
                {
                    term->cur_x = 0;
                    term->cur_y = term->scroll_top;
                }
            }
            return;
        }
    case EShash:
        term->esc_state = ESnormal;
        switch(c)
        {
        case '8':  // fill the screen with 'E'
            clean_screen(term, 'E');
            //vt100_redraw(term);
            break;
        }
        break;
    }
}
Ejemplo n.º 6
0
/*! MyWindow constructor
 * \param w - window width
 * \param h - window hight
 */
MyWindow::MyWindow(int w, int h) : num_of_colors(18)
{
  myBar = new QTabWidget(this);
  setCentralWidget(myBar);
  m_width = w;
  m_height = h;
  tab_number = 0;
  number_of_tabs = 0;
  testlayer = new Qt_layer( myBar );
  colors_flag = true;
  statusBar();

  m_scailing_factor = 2;

  // Traits Group
  QActionGroup *traitsGroup = new QActionGroup( this ); // Connected later
  traitsGroup->setExclusive( TRUE );

  /*setSegmentTraits = new QAction("Segment Traits",
                                 QPixmap( (const char**)line_xpm ),
                                 "&Segment Traits", 0 ,traitsGroup,
                                 "Segment Traits" );
  setSegmentTraits->setToggleAction( TRUE );

  setPolylineTraits = new QAction("Polyline Traits",
                                  QPixmap( (const char**)polyline_xpm ),
                                  "&Polyline Traits", 0 , traitsGroup,
                                  "Polyline Traits" );
  setPolylineTraits->setToggleAction( TRUE );

#ifdef CGAL_USE_CORE
  setConicTraits = new QAction("Conic Traits",
                               QPixmap( (const char**)conic_xpm ),
                               "&Conic Traits", 0 , traitsGroup,
                               "Conic Traits" );
  setConicTraits->setToggleAction( TRUE );
#endif
*/
  // Snap Mode Group

  setSnapMode = new QAction("Snap Mode", QPixmap( (const char**)snapvertex_xpm ),
                            "&Snap Mode", 0 , this, "Snap Mode" );
  setSnapMode->setToggleAction( TRUE );

  setGridSnapMode = new QAction("Grid Snap Mode",
                                QPixmap( (const char**)snapgrid_xpm ),
                                "&Grid Snap Mode", 0 , this,
                                "Grid Snap Mode" );
  setGridSnapMode->setToggleAction( TRUE );

  // insert - delete - point_location Mode Group
  QActionGroup *modeGroup = new QActionGroup( this ); // Connected later
  modeGroup->setExclusive( TRUE );

  insertMode = new QAction("Insert", QPixmap( (const char**)insert_xpm ),
                           "&Insert", 0 , modeGroup, "Insert" );
  insertMode->setToggleAction( TRUE );

  deleteMode = new QAction("Delete", QPixmap( (const char**)delete_xpm ),
                           "&Delete", 0 , modeGroup, "Delete" );
  deleteMode->setToggleAction( TRUE );

  pointLocationMode = new QAction("PointLocation",
                                  QPixmap( (const char**)pointlocation_xpm ),
                                  "&Point Location", 0 , modeGroup,
                                  "Point Location" );
  pointLocationMode->setToggleAction( TRUE );

  dragMode = new QAction("Drag", QPixmap( (const char**)hand_xpm ),
                         "&Drag", 0 , modeGroup, "Drag" );
  dragMode->setToggleAction( TRUE );

  // zoom in
  zoominBt = new QAction("Zoom in", QPixmap( (const char**)zoomin_xpm ),
                         "&Zoom in", 0 , this, "Zoom in" );
  // zoom out
  zoomoutBt = new QAction("Zoom out", QPixmap( (const char**)zoomout_xpm ),
                          "&Zoom out", 0 , this, "Zoom out" );

   // color dialog
  color_dialog_bt = new QAction("Choose color", QPixmap( (const char**)demo_colors_xpm ),
                         "&choose color", 0 , this, "choose color" );

	// Cartograms
  carto_new = new QAction("New instance", QPixmap( (const char**)carto_new_xpm ),
                         "&New instance", 0 , this, "New instance" );
  carto_weights = new QAction("Set weights", QPixmap( (const char**)carto_weights_xpm ),
                         "&Set weights", 0 , this, "Set weights" );
  carto_start = new QAction("Start Cartogram", QPixmap( (const char**)carto_start_xpm ),
                          "&Start Cartogram", 0 , this, "Start Cartogram" );
  carto_it = new QAction("Next step", QPixmap( (const char**)carto_nextIt_xpm ),
                         "&Next step", 0 , this, "Next step" );

/*
#ifdef CGAL_USE_CORE
  // Conic Type Group
  QActionGroup *conicTypeGroup = new QActionGroup( this ); // Connected later
  conicTypeGroup->setExclusive( TRUE );

  setCircle = new QAction("Circle",
                                 QPixmap( (const char**)demo_conic_circle_xpm ),
                                 "&Circle", 0 ,conicTypeGroup,
                                 "Circle" );
  setCircle->setToggleAction( TRUE );
  setSegment = new QAction("Segment",
                                 QPixmap( (const char**)demo_conic_segment_xpm ),
                                 "&Segment", 0 ,conicTypeGroup,
                                 "Segment" );
  setSegment->setToggleAction( TRUE );
  setEllipse = new QAction("Ellipse",
                                 QPixmap( (const char**)demo_conic_ellipse_xpm ),
                                 "&Ellipse", 0 ,conicTypeGroup,
                                 "Ellipse" );
  setEllipse->setToggleAction( TRUE );
  setParabola = new QAction("3 Points Arc",
                                 QPixmap( (const char**)demo_conic_3points_xpm ),
                                 "&3 Points Arc", 0 ,conicTypeGroup,
                                 "3 Points Arc" );
  setParabola->setToggleAction( TRUE );
  setHyperbola = new QAction("5 Points Arc",
                                 QPixmap( (const char**)demo_conic_5points_xpm ),
                                 "&5 Points Arc", 0 ,conicTypeGroup,
                                 "5 Points Arc" );
  setHyperbola->setToggleAction( TRUE );
#endif
*/
  //create a timer for checking if somthing changed
  QTimer *timer = new QTimer( this );
  connect( timer, SIGNAL(timeout()),
           this, SLOT(timer_done()) );
  timer->start( 200, FALSE );

  // file menu
  QPopupMenu * file = new QPopupMenu( this );
  menuBar()->insertItem( "&File", file );
  /*
  file->insertItem("&Open Segment File...", this, SLOT(fileOpenSegment()));
  file->insertItem("&Open Polyline File...", this, SLOT(fileOpenPolyline()));\
  file->insertItem("&Open Segment Arr File...", this, SLOT(fileOpenSegmentPm()));
  file->insertItem("&Open Polyline Arr File...", this, SLOT(fileOpenPolylinePm()));
  file->insertItem("&Open Conic Pm File", this, SLOT(fileOpenConicPm()));
  */
  file->insertItem("&Open Input File...", this, SLOT(fileOpenSegment()));
  file->insertItem("&Open Output File...", this, SLOT(fileOpenConic()));

  file->insertItem("&Save...", this, SLOT(fileSave()));
  file->insertItem("&Save As...", this, SLOT(fileSaveAs()));
  //file->insertItem("&Save to ps...", this, SLOT(fileSave_ps()));
  file->insertSeparator();
  file->insertItem("&Print...", this , SLOT(print()));
  file->insertSeparator();
  file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X );
  file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );
  menuBar()->insertSeparator();

  // tab menu
  QPopupMenu * tab = new QPopupMenu( this );
  menuBar()->insertItem( "&Tab", tab );
/*
  tab->insertItem("Add &Segment Tab", this, SLOT(add_segment_tab()));
  tab->insertItem("Add &Polyline Tab", this, SLOT(add_polyline_tab()));

#ifdef CGAL_USE_CORE
  tab->insertItem("Add &Conic Tab", this, SLOT(add_conic_tab()));
  tab->insertSeparator();
#endif
*/
  tab->insertItem("Remove &Tab", this, SLOT(remove_tab()));
  menuBar()->insertSeparator();

  // mode menu
  QPopupMenu * mode = new QPopupMenu( this );
  menuBar()->insertItem( "&Mode", mode );
  insertMode->addTo( mode );
  deleteMode->addTo( mode );
  pointLocationMode->addTo( mode );
  dragMode->addTo( mode );
  menuBar()->insertSeparator();

  // snap mode menu
  QPopupMenu * snap_mode = new QPopupMenu( this );
  menuBar()->insertItem( "&Snap mode", snap_mode );
  setSnapMode->addTo(snap_mode);
  setGridSnapMode->addTo(snap_mode);
  menuBar()->insertSeparator();

  // traits menu
  /*QPopupMenu * traits = new QPopupMenu( this );
  menuBar()->insertItem( "&Traits Type", traits );
  setSegmentTraits->addTo(traits);
  setPolylineTraits->addTo(traits);
#ifdef CGAL_USE_CORE
  setConicTraits->addTo(traits);
#endif
*/
  // options menu
  QPopupMenu * options = new QPopupMenu( this );
  menuBar()->insertItem( "&Options", options );
  options->insertSeparator();
  //options->insertItem("Overlay...", this, SLOT(overlay_pm()));
  options->insertSeparator();
  options->insertItem("Properties...", this, SLOT(properties()));
  options->insertSeparator();
  options->insertItem("Show Grid", this, SLOT(showGrid()));
  options->insertItem("Hide Grid", this, SLOT(hideGrid()));
  options->insertSeparator();
  //options->insertItem("Conic Type", this, SLOT(conicType()));
  //options->insertSeparator();
  options->insertItem("Unbounded Face Color...", this, SLOT(backGroundColor()));
  options->insertSeparator();
  options->insertItem("Edge Color...", this, SLOT(changeEdgeColor()));
  options->insertSeparator();
  options->insertItem("Vertex Color...", this, SLOT(changeVertexColor()));
  options->insertSeparator();
  /*options->insertItem("Point-Locaiton Strategy....", this ,
                                         SLOT(pointLocationStrategy()));
*/
  QToolBar *modeTools = new QToolBar( this, "mode operations" );
  modeTools->setLabel( "Mode Operations" );
  insertMode->addTo( modeTools );
  deleteMode->addTo( modeTools );
  pointLocationMode->addTo( modeTools );
  dragMode->addTo( modeTools );
  modeTools->addSeparator();

  QToolBar *snapModeTools = new QToolBar( this, "snapMode operations" );
  snapModeTools->setLabel( "Snap Mode Operations" );
  snapModeTools->addSeparator();
  setSnapMode->addTo( snapModeTools );
  setGridSnapMode->addTo( snapModeTools );
  snapModeTools->addSeparator();

  /*QToolBar *traitsTool = new QToolBar( this, "traits type" );
  traitsTool->setLabel( "Traits Type" );
  traitsTool->addSeparator();
  setSegmentTraits->addTo( traitsTool );
  setPolylineTraits->addTo( traitsTool );
#ifdef CGAL_USE_CORE
  setConicTraits->addTo( traitsTool );
#endif
  traitsTool->addSeparator();
*/
  QToolBar *zoomTool = new QToolBar( this, "zoom" );
  zoomTool->setLabel( "Zoom" );
  zoomTool->addSeparator();
  zoomoutBt->addTo( zoomTool );
  zoominBt->addTo( zoomTool );
  zoomTool->addSeparator();

  QToolBar *colorTool = new QToolBar( this, "color" );
  colorTool->addSeparator();
  colorTool->setLabel("Choose color");
  color_dialog_bt->addTo(colorTool);
  colorTool->addSeparator();

  QToolBar *cartoTool = new QToolBar( this, "cartograms" );
  cartoTool->addSeparator();
  cartoTool->setLabel("Cartograms");
  carto_new->addTo(cartoTool);
  carto_weights->addTo(cartoTool);
  carto_start->addTo(cartoTool);
  carto_it->addTo(cartoTool);
  cartoTool->addSeparator();

/*
#ifdef CGAL_USE_CORE
  conicTypeTool = new QToolBar( this, "conic type" );
  conicTypeTool->setLabel( "Conic Type" );
  conicTypeTool->addSeparator();
  setSegment->addTo( conicTypeTool );
  setCircle->addTo( conicTypeTool );
  setEllipse->addTo( conicTypeTool );
  setParabola->addTo( conicTypeTool );
  setHyperbola->addTo( conicTypeTool );
#endif
*/

  connect( zoomoutBt, SIGNAL( activated () ) ,
       this, SLOT( zoomout() ) );

  connect( zoominBt, SIGNAL( activated () ) ,
       this, SLOT( zoomin() ) );

  connect (color_dialog_bt , SIGNAL( activated()) ,
          this , SLOT(openColorDialog() ) );

  // connect mode group
  connect( modeGroup, SIGNAL( selected(QAction*) ),
           this, SLOT( updateMode(QAction*) ) );

  // connect Traits Group
/*  connect( traitsGroup, SIGNAL( selected(QAction*) ),
           this, SLOT( updateTraitsType(QAction*) ) );

#ifdef CGAL_USE_CORE
  // connect Conic Type Group
  connect( conicTypeGroup, SIGNAL( selected(QAction*) ),
           this, SLOT( updateConicType(QAction*) ) );
#endif
*/
  // connect Snap Mode

  connect( setSnapMode, SIGNAL( toggled( bool ) ) ,
           this, SLOT( updateSnapMode( bool ) ) );

  connect( setGridSnapMode, SIGNAL( toggled( bool ) ) ,
       this, SLOT( updateGridSnapMode( bool ) ) );

  // connect the change of current tab
  connect( myBar, SIGNAL( currentChanged(QWidget * )  ),
           this, SLOT( update() ) );

	// connect cartogram actions
	connect( carto_start, SIGNAL( activated () ) ,
       this, SLOT( cartogram_start() ) );

	connect( carto_weights, SIGNAL( activated () ) ,
       this, SLOT( cartogram_weights() ) );

	connect( carto_it, SIGNAL( activated () ) ,
       this, SLOT( print_all_weights()));

	connect( carto_new, SIGNAL( activated () ) ,
       this, SLOT( cartogram_balance() ) );

  colors = new QColor[num_of_colors];
  colors[0]  =  Qt::blue;
  colors[1]  =  Qt::gray;
  colors[2]  =  Qt::green;
  colors[3]  =  Qt::cyan;
  colors[4]  =  Qt::magenta;
  colors[5]  =  Qt::darkRed;
  colors[6]  =  Qt::darkGreen;
  colors[7]  =  Qt::darkBlue;
  colors[8]  =  Qt::darkMagenta;
  colors[9]  =  Qt::darkCyan;
  colors[10] =  Qt::yellow;
  colors[11] =  Qt::white;
  colors[12] =  Qt::darkGray;
  colors[13] =  Qt::gray;
  colors[14] =  Qt::red;
  colors[15] =  Qt::cyan;
  colors[16] =  Qt::darkYellow;
  colors[17] =  Qt::lightGray;

  //state flag
  old_state = 0;
  add_conic_tab();
  resize(m_width,m_height);
}