Beispiel #1
0
// =====================
//     PRIVATE SLOTS
// =====================
void LDesktop::InitDesktop(){
  //This is called *once* during the main initialization routines
  checkResolution(); //Adjust the desktop config file first (if necessary)
  if(DEBUG){ qDebug() << "Init Desktop:" << desktopnumber; }
    //connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int)));
  if(DEBUG){ qDebug() << "Desktop #"<<desktopnumber<<" -> "<< desktop->screenGeometry(desktopnumber) << LSession::handle()->screenGeom(desktopnumber); }
  deskMenu = new QMenu(0);
    connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) );
  winMenu = new QMenu(0);
    winMenu->setTitle(tr("Window List"));
    winMenu->setIcon( LXDG::findIcon("preferences-system-windows","") );
  connect(winMenu, SIGNAL(triggered(QAction*)), this, SLOT(winClicked(QAction*)) );
  workspacelabel = new QLabel(0);
    workspacelabel->setAlignment(Qt::AlignCenter);
  wkspaceact = new QWidgetAction(0);
    wkspaceact->setDefaultWidget(workspacelabel);
  bgtimer = new QTimer(this);
    bgtimer->setSingleShot(true);
    connect(bgtimer, SIGNAL(timeout()), this, SLOT(UpdateBackground()) );

    connect(QApplication::instance(), SIGNAL(DesktopConfigChanged()), this, SLOT(SettingsChanged()) );
    connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(UpdateDesktop()) );
    connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChanged()) );

  if(DEBUG){ qDebug() << "Create bgWindow"; }
  bgWindow = new QWidget();
	bgWindow->setObjectName("bgWindow");
	bgWindow->setContextMenuPolicy(Qt::CustomContextMenu);
	bgWindow->setFocusPolicy(Qt::StrongFocus);
  	bgWindow->setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
	LSession::handle()->XCB->SetAsDesktop(bgWindow->winId());
	bgWindow->setGeometry(LSession::handle()->screenGeom(desktopnumber));
	connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) );
  if(DEBUG){ qDebug() << "Create bgDesktop"; }
  bgDesktop = new LDesktopPluginSpace(bgWindow); //new QMdiArea(bgWindow);
      int grid = settings->value(DPREFIX+"GridSize",-1).toInt();
      if(grid<0 && bgWindow->height() > 2000){ grid = 200; }
      else if(grid<0){ grid = 100; }
      bgDesktop->SetIconSize( grid );
      connect(bgDesktop, SIGNAL(PluginRemovedByUser(QString)), this, SLOT(RemoveDeskPlugin(QString)) );
      connect(bgDesktop, SIGNAL(IncreaseIcons()), this, SLOT(IncreaseDesktopPluginIcons()) );
      connect(bgDesktop, SIGNAL(DecreaseIcons()), this, SLOT(DecreaseDesktopPluginIcons()) );
      connect(bgDesktop, SIGNAL(HideDesktopMenu()), deskMenu, SLOT(hide()));
  if(DEBUG){ qDebug() << " - Desktop Init Done:" << desktopnumber; }
  //Start the update processes
  QTimer::singleShot(10,this, SLOT(UpdateMenu()) );
  QTimer::singleShot(0,this, SLOT(UpdateBackground()) );
  QTimer::singleShot(1,this, SLOT(UpdateDesktop()) );
  QTimer::singleShot(2,this, SLOT(UpdatePanels()) );
}
Beispiel #2
0
// =====================
//     PRIVATE SLOTS
// =====================
void LDesktop::InitDesktop(){
  //This is called *once* during the main initialization routines
  checkResolution(); //Adjust the desktop config file first (if necessary)
  if(DEBUG){ qDebug() << "Init Desktop:" << desktopnumber; }
    //connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int)));
  if(DEBUG){ qDebug() << "Desktop #"<<desktopnumber<<" -> "<< desktop->screenGeometry(desktopnumber) << LSession::handle()->screenGeom(desktopnumber); }
  deskMenu = new QMenu(0);
    connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) );
  winMenu = new QMenu(0);
    winMenu->setTitle(tr("Window List"));
    winMenu->setIcon( LXDG::findIcon("preferences-system-windows","") );
  connect(winMenu, SIGNAL(triggered(QAction*)), this, SLOT(winClicked(QAction*)) );
  workspacelabel = new QLabel(0);
    workspacelabel->setAlignment(Qt::AlignCenter);
  wkspaceact = new QWidgetAction(0);
    wkspaceact->setDefaultWidget(workspacelabel);
  bgtimer = new QTimer(this);
    bgtimer->setSingleShot(true);
    connect(bgtimer, SIGNAL(timeout()), this, SLOT(UpdateBackground()) );

    connect(QApplication::instance(), SIGNAL(DesktopConfigChanged()), this, SLOT(SettingsChanged()) );
    connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(UpdateDesktop()) );
    connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChanged()) );

  if(DEBUG){ qDebug() << "Create bgWindow"; }
  bgWindow = new QWidget();
	bgWindow->setObjectName("bgWindow");
	bgWindow->setContextMenuPolicy(Qt::CustomContextMenu);
  	bgWindow->setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
	LSession::handle()->XCB->SetAsDesktop(bgWindow->winId());
	bgWindow->setGeometry(LSession::handle()->screenGeom(desktopnumber));
	connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu(const QPoint&)) );
  if(DEBUG){ qDebug() << "Create bgDesktop"; }
  bgDesktop = new QMdiArea(bgWindow);
	//Make sure the desktop area is transparent to show the background
        bgDesktop->setBackground( QBrush(Qt::NoBrush) );
	bgDesktop->setStyleSheet( "QMdiArea{ border: none; background: transparent;}" );
  if(DEBUG){ qDebug() << " - Desktop Init Done:" << desktopnumber; }
  //Start the update processes
  QTimer::singleShot(10,this, SLOT(UpdateMenu()) );
  QTimer::singleShot(0,this, SLOT(UpdateBackground()) );
  QTimer::singleShot(1,this, SLOT(UpdateDesktop()) );
  QTimer::singleShot(2,this, SLOT(UpdatePanels()) );
}
////////////////////////////////////////////////////////////////////////////////
// Предварительная обработка
// (07.07.2000) Изначально взято из puma.dll без изменений
// сильно привязана к пуме
// в начале окучиваем выделение компонент
Bool32 PreProcessImage( PRSPreProcessImage Image )
{

	Bool32 gbAutoRotate          = Image->gbAutoRotate;
	puchar *gpRecogDIB           = Image->pgpRecogDIB;
	Handle hCPAGE                = Image->hCPAGE;
	const char * glpRecogName    = *Image->pglpRecogName;
	PCIMAGEBITMAPINFOHEADER info = (PCIMAGEBITMAPINFOHEADER)Image->pinfo;
	/////////////////////////////////
	Bool32 rc = TRUE;
	//char * lpRecogName = NULL;
	uint32_t Angle = 0;

	hWndTurn = 0;

	if(InitPRGTIME())
		ProgressStart();

	if(!ProgressStep(1,5))
		rc = FALSE;

	// Andrey 12.11.01
	// Проинициализируем контейнер CPAGE
	//
	if(rc)
	{
		PAGEINFO           PInfo = {0};
		GetPageInfo(hCPAGE,&PInfo);
		strcpy((char*)PInfo.szImageName, glpRecogName);
		PInfo.BitPerPixel = info->biBitCount;
		PInfo.DPIX = info->biXPelsPerMeter*254L/10000;
//		PInfo.DPIX = PInfo.DPIX < 200 ? 200 : PInfo.DPIX;
		PInfo.DPIY = info->biYPelsPerMeter*254L/10000;
//		PInfo.DPIY = PInfo.DPIY < 200 ? 200 : PInfo.DPIY;
		PInfo.Height = info->biHeight;
		PInfo.Width = info->biWidth;
//		PInfo.X = 0; Уже установлено
//		PInfo.Y = 0;
		PInfo.Incline2048 = 0;
		PInfo.Page = 1;
		PInfo.Angle = Angle;

		SetPageInfo(hCPAGE,PInfo);
	}

	////////////////////////////////////////////////////////
	// Выделим компоненты
	//
	if(!ProgressStep(2,65))
		rc = FALSE;

	if(rc)
	{
		if(LDPUMA_Skip(Image->hDebugCancelComponent)/*DPumaSkipComponent()*/)
		{
//			uchar ori;
			PRGTIME prev = StorePRGTIME(65, 85);
			rc = ExtractComponents( gbAutoRotate, NULL, (puchar)glpRecogName, Image);
			RestorePRGTIME(prev);
/*			if(rc && gbAutoRotate)
			{
				//if(!REXC_GetOrient(&ori))
				//if(!REXC_GetOrient(&ori) && db_spec_prj!=SPEC_PRJ_GIP )
				if(!RNORM_GetOrient(&ori, *(Image->phCCOM)) && db_spec_prj!=SPEC_PRJ_GIP )
				{
					SetReturnCode_rstuff(RNORM_GetReturnCode());
					rc = FALSE;
				}
				else
				{
					//if(ori)
					if(ori && !(db_spec_prj==SPEC_PRJ_GIP&&ori==4))
					{
						uint32_t dwTurn = 0;
						switch(ori)
						{
						case 1:
							Angle = 270;
							dwTurn = RIMAGE_TURN_270;
							break;
						case 2:
							Angle = 90;
							dwTurn = RIMAGE_TURN_90;
							break;
						case 3:
							Angle = 180;
							dwTurn = RIMAGE_TURN_180;
							break;
						}

						if( LDPUMA_Skip(Image->hDebugCancelTurn) /*umaSkipTurn()*/ /*)
						{
							if(!RIMAGE_Turn((puchar)glpRecogName,(puchar)PUMA_IMAGE_TURN,dwTurn,0))
							{
								SetReturnCode_rstuff_rstuff(RIMAGE_GetReturnCode());
								rc = FALSE;
							}
							else
							{

								if(!CIMAGE_ReadDIB((puchar)PUMA_IMAGE_TURN,(Handle*)gpRecogDIB,TRUE))
								{
									SetReturnCode_rstuff_rstuff(CIMAGE_GetReturnCode());
									rc = FALSE;
								}
								else
								{
									//
									//  удалим общий контейнер
									//
									glpRecogName = PUMA_IMAGE_TURN;
									hWndTurn = LDPUMA_CreateWindow(PUMA_IMAGE_TURN,(*gpRecogDIB));
									PRGTIME prev = StorePRGTIME(85, 100);
									rc = ExtractComponents( FALSE, NULL, (puchar)glpRecogName, Image);
									PAGEINFO info = {0};
		                            GetPageInfo(hCPAGE,&info);
									info.Images|=IMAGE_TURN;
//									strcpy((char*)info.szImageName,PUMA_IMAGE_TURN);
		                            SetPageInfo(hCPAGE,info);
                                    RestorePRGTIME(prev);
								}
							}
						}
					}
				}
			}*/

			//проверим наличие разрешения и попытаемся определить по компонентам, если его нет
			checkResolution(*(Image->phCCOM), hCPAGE);
			if(!ProgressStep(2,100))
				rc = FALSE;

		}
		else
			LDPUMA_Console("Пропущен этап выделения компонент.\n");
	}
	//
	// Переинициализируем контейнер CPAGE
	//
	if(rc)
	{
		PAGEINFO           PInfo = {0};
		GetPageInfo(hCPAGE,&PInfo);
		strcpy((char*)PInfo.szImageName, glpRecogName);
		PInfo.BitPerPixel = info->biBitCount;
//		PInfo.DPIX = info->biXPelsPerMeter*254L/10000;
		PInfo.DPIX = PInfo.DPIX < 200 ? 200 : PInfo.DPIX;
//		PInfo.DPIY = info->biYPelsPerMeter*254L/10000;
		PInfo.DPIY = PInfo.DPIY < 200 ? 200 : PInfo.DPIY;
		PInfo.Height = info->biHeight;
		PInfo.Width = info->biWidth;
//		PInfo.X = 0; Уже установлено
//		PInfo.Y = 0;
		PInfo.Incline2048 = 0;
		PInfo.Page = 1;
		PInfo.Angle = Angle;

		SetPageInfo(hCPAGE,PInfo);
	}

	if(DonePRGTIME())
		ProgressFinish();

	return rc;
}