Example #1
0
TilesetEditor::TilesetEditor(QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle(tr("Tileset Editor"));

    // Create GUI Items
    _new_pbut = new QPushButton(tr("New"), this);
    _open_pbut = new QPushButton(tr("Open"), this);
    _save_pbut = new QPushButton(tr("Save"), this);
    _exit_pbut = new QPushButton(tr("Exit"), this);
    _exit_pbut->setDefault(true);

    // Create the window
    _tset_display = new TilesetDisplay;
    _tset_display->resize(512, 512);
    _tset_display->setFixedWidth(512);
    _tset_display->setFixedHeight(512);

    // connect button signals
    connect(_new_pbut, SIGNAL(clicked()), this, SLOT(_NewFile()));
    connect(_open_pbut, SIGNAL(clicked()), this, SLOT(_OpenFile()));
    connect(_save_pbut, SIGNAL(clicked()), this, SLOT(_SaveFile()));
    connect(_exit_pbut, SIGNAL(released()), this, SLOT(reject()));

    // Add all of the aforementioned widgets into a nice-looking grid layout
    _dia_layout = new QGridLayout(this);
    _dia_layout->addWidget(_new_pbut, 0, 1);
    _dia_layout->addWidget(_open_pbut, 1, 1);
    _dia_layout->addWidget(_save_pbut, 2, 1);
    _dia_layout->addWidget(_exit_pbut, 3, 1);
    _dia_layout->addWidget(_tset_display, 0, 0, 3, 1);
}
Example #2
0
int GDocApp<OptionsFmt>::OnCommand(int Cmd, int Event, OsView Window)
{
	switch (Cmd)
	{
		case IDM_SAVE:
		{
			if (!GetCurFile())
			{
				GMru::OnCommand(IDM_SAVEAS);
				return 0;
			}
			else
			{
				_SaveFile(GetCurFile());
				return 0;
			}
			break;
		}
		case IDM_CLOSE:
		{
			if (SetDirty(false))
				_Close();
			break;
		}
		case IDM_EXIT:
		{
			LgiCloseApp();
			break;
		}
	}

	GMru::OnCommand(Cmd);
	return 0;
}
Example #3
0
void UIIMEdit::_ImEditPaste()
{
	BOOL bHadPic = FALSE;
	if (::OpenClipboard(::GetDesktopWindow()))
	{
		if (IsClipboardFormatAvailable(CF_BITMAP))
		{
			HBITMAP hBitmap = (HBITMAP)::GetClipboardData(CF_BITMAP);
			BITMAP bitmap;
			GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bitmap);
			SIZE bitmapSize = { bitmap.bmWidth, bitmap.bmHeight };
			if (hBitmap)
			{
				_SaveFile(hBitmap, m_strImagePath);
				InsertImage(m_strImagePath.GetBuffer(), bitmapSize, FALSE);
				bHadPic = TRUE;
			}
		}
		else if (IsClipboardFormatAvailable(CF_HDROP))
		{
			HDROP hDrop = (HDROP)GetClipboardData(CF_HDROP);
			onDropFiles(hDrop);
		}
		CloseClipboard();
	}
}
Example #4
0
bool GDocApp<OptionsFmt>::SetDirty(bool Dirty)
{
	if (IsAttached() && (d->Dirty ^ Dirty))
	{
		// Changing...
		if (Dirty)
		{
			// Setting dirty
			d->Dirty = true;
			SetCurFile(d->CurFile);
		}
		else
		{
			// Clearing dirty
			int Result = LgiMsg(this,
								LgiLoadString(L_DOCAPP_SAVE_CHANGE, "Do you want to save your changes?"),
								d->AppName,
								MB_YESNOCANCEL);
			if (Result == IDYES)
			{
				if (!ValidStr(d->CurFile))
				{
					GMru::OnCommand(IDM_SAVEAS);
				}
				else
				{
					_SaveFile(d->CurFile);
				}
			}
			else if (Result == IDCANCEL)
			{
				return false;
			}

			d->Dirty = false;
			SetCurFile(d->CurFile);
		}

		OnDirty(d->Dirty);
	}

	return true;
}