Esempio n. 1
0
/**
 * \brief    Constructeur de DocumentEditorRow
 * \details  Construit une ligne d'édition pour le DocumentEditor en construisant
 *           un éditeur pliable et les boutons pour déplacer une note dans le document,
 *           l'éditer directement dans la fenêtre principale ou la supprimer
 */
DocumentEditorRow::DocumentEditorRow(Note *n, QWidget *parent) :
    QWidget(parent) {
    editor = new FoldableEditor(NotesEditorFactory::getInstance().getNewNoteEditor(n, this), this);
    QObject::connect(editor, SIGNAL(onOpen()), this, SLOT(setSideBarVertical()));
    QObject::connect(editor, SIGNAL(onClose()), this, SLOT(setSideBarHorizontal()));
    moveUpBtn = new QPushButton(QIcon("moveUp.png"), "", this);
    moveUpBtn->setFixedSize(30, 30);
    QObject::connect(moveUpBtn, SIGNAL(clicked()), this, SLOT(moveUp()));
    moveDownBtn = new QPushButton(QIcon("moveDown.png"), "", this);
    moveDownBtn->setFixedSize(30, 30);
    QObject::connect(moveDownBtn, SIGNAL(clicked()), this, SLOT(moveDown()));
    editBtn = new QPushButton(QIcon("editer.png"), "", this);
    editBtn->setFixedSize(30, 30);
    QObject::connect(editBtn, SIGNAL(clicked()), this, SLOT(edit()));
    supressBtn = new QPushButton(QIcon("supprimer.png"), "", this);
    supressBtn->setFixedSize(30, 30);
    QObject::connect(supressBtn, SIGNAL(clicked()), this, SLOT(supress()));
    addBtn = new QPushButton("Ajouter une note existante");
    QObject::connect(addBtn, SIGNAL(clicked()), this, SLOT(add()));
    createBtn = new QPushButton("Créer une note");
    QObject::connect(createBtn, SIGNAL(clicked()), this, SLOT(create()));

    subLayout = new QBoxLayout(QBoxLayout::LeftToRight);
    subLayout->addWidget(moveUpBtn);
    subLayout->addWidget(moveDownBtn);
    subLayout->addWidget(editBtn);
    subLayout->addWidget(supressBtn);

    QHBoxLayout* hLayout = new QHBoxLayout();
    hLayout->addWidget(editor);
    hLayout->addLayout(subLayout);

    QHBoxLayout* addLayout = new QHBoxLayout();
    addLayout->addWidget(addBtn);
    addLayout->addWidget(createBtn);

    layout = new QVBoxLayout();
    layout->addLayout(hLayout);
    layout->addLayout(addLayout);

    this->setLayout(layout);
}
Esempio n. 2
0
F2D* harris(I2D* im)
{
    F2D *img1;
    F2D *g1, *g2, *g;
    F2D *Ix, *Iy;
    F2D *Ix2, *Iy2, *IxIy;
    F2D *v, *R, *Rmax, *Rnm;
    float eps;
    F2D *sobel, *sob, *temp, *temp1;    
    I2D *win, *x, *y;
    int i;
    
    g1 = fSetArray(5,5,0);
    g2 = fSetArray(3,3,0);

    asubsref(g1,0) = 1;
    asubsref(g1,1) = 4;
    asubsref(g1,2) = 6;
    asubsref(g1,3) = 4;
    asubsref(g1,4) = 1;

    asubsref(g1,5) = 4;
    asubsref(g1,6) = 16;
    asubsref(g1,7) = 24;
    asubsref(g1,8) = 16;
    asubsref(g1,9) = 4;

    asubsref(g1,10) = 6;
    asubsref(g1,11) = 24;
    asubsref(g1,12) = 36;
    asubsref(g1,13) = 24;
    asubsref(g1,14) = 6;

    asubsref(g1,15) = 4;
    asubsref(g1,16) = 16;
    asubsref(g1,17) = 24;
    asubsref(g1,18) = 16;
    asubsref(g1,19) = 4;

    asubsref(g1,20) = 1;
    asubsref(g1,21) = 4;
    asubsref(g1,22) = 6;
    asubsref(g1,23) = 4;
    asubsref(g1,24) = 1;

    asubsref(g2,0) = 1;
    asubsref(g2,1) = 2;
    asubsref(g2,2) = 1;
    
    asubsref(g2,3) = 2;
    asubsref(g2,4) = 4;
    asubsref(g2,5) = 2;

    asubsref(g2,6) = 1;
    asubsref(g2,7) = 2;
    asubsref(g2,8) = 1;
    
    g = fDivide(g1, 256);
    sob = fMallocHandle(1,3);
    asubsref(sob,0) = -0.5;
    asubsref(sob,1) = 0;
    asubsref(sob,2) = 0.5;

    {
        F2D* imf;
        imf = fiDeepCopy(im);
        img1 = ffConv2(imf, g);
        fFreeHandle(imf);
    }

    Ix = ffConv2(img1, sob); 
    fFreeHandle(sob);
    sob = fMallocHandle(3,1);
    asubsref(sob,0) = -0.5;
    asubsref(sob,1) = 0;
    asubsref(sob,2) = 0.5;
    Iy = ffConv2(img1, sob);

    fFreeHandle(g);
    g = fDivide(g2, 16);
    eps = 2.2204e-16;
    sobel = fTimes(Ix, Ix);
    Ix2 = ffConv2(sobel, g);
    fFreeHandle(sobel);

    sobel = fTimes(Iy, Iy);
    Iy2 = ffConv2(sobel, g);
    fFreeHandle(sobel);

    sobel = fTimes(Ix, Iy);
    IxIy = ffConv2(sobel, g);
    fFreeHandle(sobel);
 
    temp = fTimes(Ix2, Iy2);
    temp1 = fTimes(IxIy, IxIy);
    sobel = fMinus(temp, temp1);

    fFreeHandle(temp);
    temp = fPlus(Ix2, Iy2);

    for(i=0; i<(temp->height*temp->width); i++)
        asubsref(temp,i) += eps;

    R = ffDivide(sobel, temp);
    
    win = iSetArray(1,2,3);
    Rmax = maxWindow(R, win);
    Rnm = supress(R, Rmax);

    v = fFind3(Rnm);
    
    iFreeHandle(win);
    fFreeHandle(Rmax);
    fFreeHandle(Rnm);
    fFreeHandle(R);
    
    fFreeHandle(img1);
    fFreeHandle(g1);
    fFreeHandle(g2);
    fFreeHandle(g);
    fFreeHandle(Ix);
    fFreeHandle(Iy);
    fFreeHandle(Ix2);
    fFreeHandle(Iy2);
    fFreeHandle(IxIy);
    fFreeHandle(sobel);
    fFreeHandle(sob);
    fFreeHandle(temp);
    fFreeHandle(temp1);
//    iFreeHandle(x);
//    iFreeHandle(y);
    
    return v;
}
Esempio n. 3
0
int main( int argc, char *arvg[] ) {
	int quit = 0;
	int config_status = 0;
	int event;

#ifdef __WIN32__
	freopen( "cabrio.out", "w", stdout );
	freopen( "cabrio.err", "w", stderr );
#endif

	config_status = config_open( NULL );
	if( config_status == -1 )
		return -1;

	if( sdl_init() != 0 )
		bail();

	if( ogl_init() != 0 )
		bail();
	
	/* Clear the screen as soon as we can. This avoids graphics
	 * glitches which can occur with some SDL implementations. */
	ogl_clear();
	sdl_swap();

	if( event_init() != 0 )
		bail();

	if( font_init() != 0 )
		bail();

	if( config_status == 1 ) {
		/* Config file didn't exist, so run the setup utility */
		if( setup() != 0 )
			return -1;
		config_update();
		if( config_create() != 0 )
			return -1;
	}

	location_init();

	/* If config or location results in a new font, it'll be loaded here. */
	font_free();
	font_init();

	/* Large game lists take a while to initialise,
	 * so show the background while we wait... */
	bg_init();
	bg_clear();
	bg_draw();
	sdl_swap();

	if( platform_init() != 0 )
		bail();

	if( category_init() != 0 )
		bail();

	if( game_sel_init() != 0 )
		bail();

	if( hint_init() != 0 )
		bail();

	if( snap_init() != 0 )
		bail();
	
	if( game_list_create() != 0 )
		bail();

	if( menu_init() != 0 )
		bail();

	if( submenu_init() != 0 )
		bail();

	sound_init();
	video_init();
	
	event_flush();

	if( !config_get()->iface.theme.menu.auto_hide )
		menu_show();
		
	focus_set( FOCUS_GAMESEL );

	while( !quit ) {
		ogl_clear();
		bg_draw();
		snap_draw();
		if (!config_get()->iface.hide_buttons)
			hint_draw();
		menu_draw();
		submenu_draw();
		game_sel_draw();
		sdl_swap();
		if (Mix_PlayingMusic() != 1 && config_get()->iface.theme_sound && reader_running == 0) 
			playmusic();
		if (( event = event_poll() )) {
			if( supress_wait == 0 ) {
				if( event == EVENT_QUIT ) {
					quit = 1;
				}
				else {
					supress();
					event_process( event );
				}
			}
		}
		if( supress_wait > 0 )
			supress_wait--;
		
		sdl_frame_delay();
	}
	clean_up();
	return 0;
}