Exemple #1
0
/* Added functions for supporting features */
int createproject (const char *file, int ndirs,
                   const char *srcdirs[])
{
    json_object     *proj = NULL;
    int             success = 0;
    json_object     *dirs = NULL;
    int             i;

    /* Build only json file */
    proj = json_object_new_object();
    if (proj) {
        json_object_object_add(proj, NAME, json_object_new_string(file));
        json_object_object_add(proj, NOFSRCDIRS, json_object_new_int(ndirs));
        dirs = json_object_new_array();
        for (i = 1; i <= ndirs; i++) {
            json_object_array_add(dirs, json_object_new_string(srcdirs[i - 1]));
        }
        json_object_object_add(proj, SRCDIRS, dirs);
    }

    json_object_to_file(file, proj);
    json_object_put(proj);
    openproject(file);
    return success;
}
Exemple #2
0
int CVICALLBACK OpenProjectConfirm (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:
			int i, checked;
/*			for (i = 0; i < projectlist.number; i++)
			{
				IsListItemChecked(panel_open,OPPANEL_TREE_ProjectList,i,&checked);
				if (checked)
				{
					MessagePopup("Number of Projects","checked");
					operatingproject = projectlist.projects[i];
					break;
				}
			}*/
			GetTreeItem(panel_open,OPPANEL_TREE_ProjectList,VAL_ALL,0,0,VAL_NEXT_PLUS_SELF,VAL_SELECTED,&i);
			if (i == -1)
			{
				MessagePopup("打开时出错!","请选中某项后再点击打开按钮");
				return -1;
			}
			if (state_open == 1)
			{
				operatingproject = projectlist.projects[i];
				getDetails(&operatingproject);
				openproject();
			}
			else
			{
				operatinggroupnum = i+1;
				openmeasuregroup();
			}
			HidePanel (panel_open);
			state_open = 0;
			DisplayPanel (panel_main);
			break;
	}
	return 0;
}
void MainWindow::createConnections()
{
    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newproject()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openproject()));

    connect(ui->actionOpenCamera, SIGNAL(triggered()), this, SLOT(opencamera()));
    connect(ui->actionFocusAssistant, SIGNAL(triggered()), this, SLOT(startfocusassistant()));
    connect(ui->leftExSlider,SIGNAL(valueChanged(int)),this,SLOT(setexposure()));
    connect(ui->rightExSlider,SIGNAL(valueChanged(int)),this,SLOT(setexposure()));

    connect(ui->actionBasler, SIGNAL(triggered()), this, SLOT(usebasler()));//暂时用来调试的功能

    connect(ui->actionProjector,SIGNAL(triggered()),this,SLOT(projectorcontrol()));

    connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(selectPath(int)));

    connect(ui->actionCalib, SIGNAL(triggered()), this, SLOT(calib()));
    connect(ui->captureButton, SIGNAL(clicked()), this, SLOT(capturecalib()));
    connect(ui->redoButton, SIGNAL(clicked()), this, SLOT(redocapture()));
    connect(ui->calibButton,SIGNAL(clicked()),this,SLOT(calibration()));

    connect(ui->actionScan,SIGNAL(triggered()),this,SLOT(scan()));
    connect(ui->findPointButton,SIGNAL(clicked()),this,SLOT(pointmatch()));
    connect(ui->reFindButton,SIGNAL(clicked()),this,SLOT(refindmatch()));
    connect(ui->startScanButton, SIGNAL(clicked()), this, SLOT(startscan()));
    connect(ui->multiFreqTest, SIGNAL(clicked()), this, SLOT(testmulitfreq()));
    //connect(ui->testR, SIGNAL(clicked()), this, SLOT(test()));//用于测试功能的暂时按键

    connect(ui->actionReconstruct,SIGNAL(triggered()),this,SLOT(reconstruct()));
    connect(ui->reconstructionButton,SIGNAL(clicked()),this,SLOT(startreconstruct()));

    connect(ui->actionSet, SIGNAL(triggered()), this, SLOT(set()));
    connect(ui->actionChinese, SIGNAL(triggered()), this, SLOT(switchlanguage()));
    connect(ui->actionEnglish, SIGNAL(triggered()), this, SLOT(switchlanguage()));
    connect(ui->pSizeValue, SIGNAL(valueChanged(int)), this, SLOT(changePointSize(int)));
    connect(ui->loadTest, SIGNAL(clicked()), this, SLOT(loadTestModel()));

    connect(ui->actionExit, SIGNAL(triggered()), pj, SLOT(close()));//解决投影窗口不能关掉的问题
    connect(ui->actionExit, SIGNAL(triggered()), fa, SLOT(close()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
}
void OpenProject()
{
	OPENFILENAME		brw;
    int which = -1;
	TCHAR cwd[MAX_PATH];
    ::SendMessage(nppData._nppHandle, NPPM_GETCURRENTSCINTILLA, 0, (LPARAM)&which);
    if (which == -1)
        return;

	HWND curScintilla = (which == 0)?nppData._scintillaMainHandle:nppData._scintillaSecondHandle;

	memset (&brw, 0, sizeof(brw));
	brw.lStructSize = sizeof(brw);
	brw.hwndOwner = curScintilla;
	brw.lpstrFile = filename;
	brw.nMaxFile  = sizeof(filename) / sizeof(TCHAR);
	GetCurrentDirectory(sizeof(cwd), cwd);
	::GetOpenFileName(&brw);
	SetCurrentDirectory(cwd);
	wcstombs(file, filename, wcslen(filename) + 1);
	openproject(file);
	projectOpened = true;
}