Docview mended (grrr) and OGL studio partially working under wxGTK

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6877 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-03-20 13:41:16 +00:00
parent 26993c4f64
commit 0a0352f2f8
7 changed files with 94 additions and 13 deletions

View File

@@ -117,31 +117,81 @@ bool csApp::CreatePalette(wxFrame *parent)
#ifdef __WXMSW__
wxBitmap PaletteArrow("arrowtool");
wxBitmap TextTool("texttool");
wxSize toolBitmapSize(32, 32);
#elif defined(__WXGTK__) || defined(__WXMOTIF__)
wxBitmap PaletteArrow(arrow_xpm);
wxBitmap TextTool(texttool_xpm);
wxSize toolBitmapSize(22, 22);
#endif
csEditorToolPalette *palette = new csEditorToolPalette(m_diagramPaletteSashWindow, ID_DIAGRAM_PALETTE, wxPoint(0, 0), wxSize(-1, -1), wxTB_HORIZONTAL|wxNO_BORDER);
palette->SetMargins(2, 2);
palette->SetToolBitmapSize(wxSize(32, 32));
palette->SetToolBitmapSize(toolBitmapSize);
palette->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, TRUE, 0, -1, NULL, "Pointer");
palette->AddTool(PALETTE_TEXT_TOOL, TextTool, wxNullBitmap, TRUE, 0, -1, NULL, "Text");
char** symbols = new char*[20];
int noSymbols = 0;
symbols[noSymbols] = "Wide Rectangle";
noSymbols ++;
symbols[noSymbols] = "Thin Rectangle";
noSymbols ++;
symbols[noSymbols] = "Triangle";
noSymbols ++;
symbols[noSymbols] = "Octagon";
noSymbols ++;
// For some reason, we're getting Gdk errors with
// some shapes, such as ones that use DrawEllipse.
#ifndef __WXGTK__
symbols[noSymbols] = "Group";
noSymbols ++;
symbols[noSymbols] = "Circle";
noSymbols ++;
symbols[noSymbols] = "Circle shadow";
noSymbols ++;
symbols[noSymbols] = "SemiCircle";
noSymbols ++;
#endif
int i;
for (i = 0; i < noSymbols; i++)
{
csSymbol* symbol = GetSymbolDatabase()->FindSymbol(symbols[i]);
if (symbol)
{
wxBitmap* bitmap = GetSymbolDatabase()->CreateToolBitmap(symbol, toolBitmapSize);
palette->AddTool(symbol->GetToolId(), *bitmap, wxNullBitmap, TRUE, 0, -1, NULL, symbol->GetName());
delete bitmap;
}
}
delete[] symbols;
#if 0
wxNode* node = GetSymbolDatabase()->GetSymbols().First();
while (node)
{
csSymbol* symbol = (csSymbol*) node->Data();
wxBitmap* bitmap = GetSymbolDatabase()->CreateToolBitmap(symbol);
wxBitmap* bitmap = GetSymbolDatabase()->CreateToolBitmap(symbol, toolBitmapSize);
palette->AddTool(symbol->GetToolId(), *bitmap, wxNullBitmap, TRUE, 0, -1, NULL, symbol->GetName());
delete bitmap;
node = node->Next();
}
#endif
palette->Realize();

View File

@@ -168,9 +168,11 @@ bool csApp::OnInit(void)
// The ordering of these is important for layout purposes
CreateDiagramToolBar(frame);
CreatePalette(frame);
CreateProjectWindow(frame);
/*
CreateProjectWindow(frame);
FillProjectTreeCtrl();
*/
// Create the shape editing menu
m_shapeEditMenu = new ShapeEditMenu;

View File

@@ -166,16 +166,31 @@ void csApp::InitSymbols()
m_symbolDatabase->AddSymbol(new csSymbol("Group", shape));
}
wxBitmap* csSymbolDatabase::CreateToolBitmap(csSymbol* symbol)
wxBitmap* csSymbolDatabase::CreateToolBitmap(csSymbol* symbol, const wxSize& toolSize)
{
int objectBitmapSize = 32;
symbol->GetShape()->Recompute();
wxBitmap *newBitmap = new wxBitmap(objectBitmapSize, objectBitmapSize);
wxBitmap *newBitmap = new wxBitmap(toolSize.x, toolSize.y);
// Test code
#if 0
wxMemoryDC memDC;
memDC.SelectObject(*newBitmap);
memDC.SetPen(* wxBLACK_PEN);
memDC.SetBrush(* wxWHITE_BRUSH);
memDC.SetBackground(wxBrush(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), wxSOLID));
memDC.SetLogicalFunction(wxCOPY);
memDC.Clear();
memDC.DrawLine(0, 0, toolSize.x, toolSize.y);
memDC.DrawLine(0, toolSize.y, toolSize.x, 0);
memDC.SelectObject(wxNullBitmap);
#endif
#if 1
wxMemoryDC memDC;
double height, width, maxSize;
symbol->GetShape()->GetBoundingBoxMax(&width, &height);
@@ -185,18 +200,22 @@ wxBitmap* csSymbolDatabase::CreateToolBitmap(csSymbol* symbol)
maxSize = width;
double borderMargin = 4.0;
double scaleFactor = (double)(objectBitmapSize / (maxSize + 2*borderMargin));
double centreX = (double)((objectBitmapSize/scaleFactor)/2.0)-1;
double scaleFactor = (double)(toolSize.x / (maxSize + 2*borderMargin));
double centreX = (double)((toolSize.x/scaleFactor)/2.0)-1;
double centreY = centreX;
memDC.SelectObject(*newBitmap);
memDC.SetUserScale(scaleFactor, scaleFactor);
memDC.SetBackground(wxBrush(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), wxSOLID));
memDC.Clear();
symbol->GetShape()->Show(TRUE);
symbol->GetShape()->Move(memDC, centreX, centreY);
memDC.SelectObject(wxNullBitmap);
#endif
return newBitmap;
}

View File

@@ -65,7 +65,7 @@ public:
void ClearSymbols();
csSymbol* FindSymbol(const wxString& name) const;
csSymbol* FindSymbol(int toolId) const;
wxBitmap* CreateToolBitmap(csSymbol* symbol);
wxBitmap* CreateToolBitmap(csSymbol* symbol, const wxSize& sz);
protected:
wxList m_symbols;

View File

@@ -26,6 +26,7 @@ samples/html/virtual/Makefile.in
samples/html/widget/Makefile.in
samples/html/zip/Makefile.in
samples/image/Makefile.in
samples/joytest/Makefile.in
samples/layout/Makefile.in
samples/listctrl/Makefile.in
samples/mdi/Makefile.in

View File

@@ -27,6 +27,7 @@ erase %dest\tex2rtf2.zip
erase %dest\jpeg.zip
erase %dest\tiff.zip
erase %dest\dialoged.zip
erase %dest\utils.zip
if direxist %dest\wx deltree /Y %dest\wx
@@ -86,6 +87,10 @@ zip32 -@ %dest\dialoged_source.zip < %src\distrib\msw\dialoged.rsp
zip32 -j %dest\dialoged.zip %dest\dialoged_source.zip %src\bin\dialoged.exe %src\bin\dialoged.hlp %src\bin\dialoged.cnt
erase %dest\dialoged_source.zip
rem Misc. utils not in the main distribution
zip32 -@ %dest\utils.zip < %src\distrib\msw\utils.rsp
zip32 -@ -u %dest\utils.zip < %src\distrib\msw\utilmake.rsp
copy %src\docs\changes.txt %dest
copy %src\docs\msw\install.txt %dest\install_msw.txt
copy %src\docs\motif\install.txt %dest\install_motif.txt
@@ -148,7 +153,8 @@ erase /Y %dest\setup.*
rem Now invoke WISE install on the new wxwin2.wse
set wisecmd="c:\Program Files\wise\wise32.exe" /C %WXWIN\distrib\msw\wxwin2.wse
echo Invoking %wisecmd...
start /w %wisecmd
start %wisecmd
pause Press any key to continue with the wxWindows distribution...
Rem ren %WXWIN\deliver\setup.EXE %WXWIN\deliver\setup_%version%.exe
cd %dest

View File

@@ -335,7 +335,10 @@ public:
// called when file format detection didn't work, can be overridden to do
// something in this case
virtual void OnOpenFileFailure() { wxFAIL_MSG(_T("file format mismatch")); }
// This is of course completely stupid, because if the file dialog is
// cancelled you get an assert. Brilliant. -- JACS
// virtual void OnOpenFileFailure() { wxFAIL_MSG(_T("file format mismatch")); }
virtual void OnOpenFileFailure() { }
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
virtual wxView *CreateView(wxDocument *doc, long flags = 0);