예제 #1
0
	Picture::Picture(int id)
	{
		auto imageResHandle = ::FindResource(nullptr, MAKEINTRESOURCE(id), MAKEINTRESOURCE(id));
		auto dataHandle = ::LoadResource(GetApplicationInstance(), imageResHandle);
		void* imageFile = ::LockResource(dataHandle);
		auto imageFileSize = ::SizeofResource(GetApplicationInstance(), imageResHandle);
		auto wicFactory = PublicResource::GetGraphicsResource().WicImagingFactory.p;
		InitializeWithBuffer(wicFactory, static_cast<unsigned char*>(imageFile), imageFileSize);
	}
void IDENewProjectWindow::clickedContinue() {
    // create project!
    if (QFile(newFolderPath() + projectname->text() + ".blitwizardproject").exists()) {
        QMessageBox::critical(this, "Project Creation Error", "There is already a project with the same name in that folder.");
        return;
    }
    if (!QDir(QDir::root()).mkpath(newFolderPath()) && !QDir(newFolderPath()).exists()) {
        QMessageBox::critical(this, "Project Creation Error", "Failed to create project directory");
        return;
    }
    if (!QFile(newGameLuaPath()).exists()) {
        // create a new game.lua file
        FILE* r = fopen(newGameLuaPath().toUtf8().constData(), "wb");
        if (!r) {
            QMessageBox::warning(this, "Project Creation Warning", "Failed to create initial game.lua file");
            return;
        }
        fclose(r);
    }
    if (project->loaded()) {
        // load in new unused window.
        IDEWindow* w = GetApplicationInstance()->openWindow();
        project = w->getProject();
    }
    project->setName(projectname->text());
    project->setProjectFolder(newFolderPath());
    project->save();

    this->hide();
}
void IDEGreetingWindow::clickedContinue() {
    int choice = 1;
    if (choiceopenproject->isChecked()) {
        choice = 2;
    }
    if (choicerecentproject->isChecked()) {
        choice = 3;
    }
    this->close();
    if (choice == 1) {
        project->createNewProjectDialog();
    } else if (choice == 2) {
        project->openProjectDialog();
    } else if (choice == 3) {
        project->openRecentProject(
        GetApplicationInstance()->settings->getRecentlyOpenedProjects()[
                    recentprojectlist->currentRow()]);
    }
}
IDEGreetingWindow::IDEGreetingWindow(QWidget *parent, IDEProject *project) :
    QDialog(parent)
{
    this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    this->setWindowTitle("Welcome");
    this->project = project;

    welcomeframe = new QFrame(this, 0);
    welcomeframe->show();
    welcomeframe->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    radiobuttonlist = new QBoxLayout(QBoxLayout::TopToBottom, welcomeframe);
    radiobuttonlist->setSizeConstraint(QLayout::SetMinimumSize);

    greetingtext = new QLabel("Welcome to the blitwizard development environment!\n"
                              "Please specify what you want to do:");
    radiobuttonlist->addWidget((QWidget*)greetingtext);
    greetingtext->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);

    choicenewproject = new QRadioButton("Start new project", 0);
    radiobuttonlist->addWidget((QWidget*)choicenewproject);
    choicenewproject->setChecked(true);

    choiceopenproject = new QRadioButton("Open project from file", 0);
    radiobuttonlist->addWidget((QWidget*)choiceopenproject);

    choicerecentproject = new QRadioButton("Choose from recently opened projects:", 0);
    radiobuttonlist->addWidget((QWidget*)choicerecentproject);

    recentprojectlist = new QListWidget();
    radiobuttonlist->addWidget((QWidget*)recentprojectlist);

    // add recent projects to list:
    std::vector<QString> recentlyOpened = GetApplicationInstance()->settings->getRecentlyOpenedProjects();
    int i = recentlyOpened.size() - 1;
    while (i >= 0) {
        QString f = recentlyOpened[i];
        recentprojectlist->addItem(
                    QString(QFileInfo(QFile(f)).fileName()) + QString(" (") + QString(f) + QString(")"));
        i--;
    }
    if (recentlyOpened.size() == 0) {
        // disable recent project option if no recent projects:
        choicerecentproject->setDisabled(true);
    } else {
        // make recent project the default choice:
        choicerecentproject->setChecked(true);
        choicenewproject->setChecked(false);
        recentprojectlist->setCurrentRow(0);
        QObject::connect(recentprojectlist, SIGNAL(currentRowChanged(int)), this, SLOT(recentProjectChoiceClicked()));
        QObject::connect(recentprojectlist, SIGNAL(clicked(QModelIndex)), this, SLOT(recentProjectChoiceClicked()));
    }

    buttonrowwidget = new QWidget(0, 0);
    radiobuttonlist->addWidget((QWidget*)buttonrowwidget);
    buttonrowwidget->show();
    buttonrowwidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    buttonrowlayout = new QBoxLayout(QBoxLayout::RightToLeft, buttonrowwidget);

    continuebutton = new QPushButton("Continue", 0);
    buttonrowlayout->addWidget((QWidget*)continuebutton);
    continuebutton->show();
    QObject::connect(continuebutton, SIGNAL(clicked()), this, SLOT(clickedContinue()));

    cancelbutton = new QPushButton("Cancel", 0);
    buttonrowlayout->addWidget((QWidget*)cancelbutton);
    cancelbutton->show();
    QObject::connect(cancelbutton, SIGNAL(clicked()), this, SLOT(clickedCancel()));

    // set proper minimum size:
    this->setMinimumSize(welcomeframe->sizeHint());
}
예제 #5
0
파일: tzsioprs.c 프로젝트: arksoftgit/10c
zOPER_EXPORT zSHORT OPERATION
CreateSironWorkObjectList( zPCHAR szDirectoryPath, zVIEW vSubtask )
{
   zVIEW  vImportList;
   zSHORT nRC;
   HWND   hWndList;
   zSHORT i, nCount;
   zCHAR  szMetaName[ 13 ];
   HWND   hWnd;
   HINSTANCE hInst;

   nRC = GetViewByName( &vImportList, "TZSIIMLO", NULL, zLEVEL_TASK );
   if ( nRC < 0 )
   {
      // Initialize empty list object.
      ActivateEmptyObjectInstance( &vImportList, "TZSIIMLO",
                                   vSubtask, zSINGLE );
      CreateEntity( vImportList, "Root", zPOS_AFTER );
      SetNameForView( vImportList, "TZSIIMLO",NULL, zLEVEL_TASK );
   }

   // Using the Windows interface, create an invisible window which
   // contains the list of all files in the directory pased of type *.wsk.
   // The *.wsk is passed to Windows to delineate the files listed.

   zstrcat( szDirectoryPath, "*.WSK" );

   GetWindowHandle( (zPULONG) &hWnd, 0, vSubtask, 0 );
   hInst = (HINSTANCE) GetApplicationInstance( vSubtask );

   hWndList = CreateWindow( "ListBox", NULL, WS_CHILD | LBS_SORT, 1, 1, 1, 1,
                            hWnd, (HMENU) 101, (HANDLE) hInst, NULL );

   SendMessage( hWndList, WM_SETREDRAW, FALSE, 0L );
   SendMessage( hWndList, LB_DIR,
                0x0000, (LONG)(LPSTR) szDirectoryPath );
   nCount = (int) SendMessage( hWndList, LB_GETCOUNT, 0, 0L );

   if ( nCount <= 0 )
   {
      // If there doesn't exist a WSK file disable the buttons OK and Delete
      SetCtrlState(vSubtask, "ImportWSK", zCONTROL_STATUS_ENABLED, FALSE);
      SetCtrlState(vSubtask, "DeleteWSK", zCONTROL_STATUS_ENABLED, FALSE);

      return( 0 );
   }

   for ( i = 0; i < nCount; i++ )
   {
      SendMessage( hWndList, LB_GETTEXT, i, (LONG)(LPSTR) szMetaName );
      TraceLineS( "//// List Meta Name: ", szMetaName );
      /*
       * remove 4 Bytes at the end of the string (.wsk)
       */
      *(szMetaName + zstrlen(szMetaName) -4 ) = 0;

      // Create the List entity
      CreateEntity( vImportList, "KatalogFile", zPOS_AFTER );
      SetAttributeFromString( vImportList, "KatalogFile", "Name", szMetaName );
   }

   return( 0 );
}