Sorted out misc/oglmisc mess
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
1dde66dda6
commit
16dc3e3df6
@ -19,7 +19,7 @@ OBJECTS = \
|
|||||||
$(OBJ_PATH)\canvas.obj \
|
$(OBJ_PATH)\canvas.obj \
|
||||||
$(OBJ_PATH)\ogldiag.obj \
|
$(OBJ_PATH)\ogldiag.obj \
|
||||||
$(OBJ_PATH)\lines.obj \
|
$(OBJ_PATH)\lines.obj \
|
||||||
$(OBJ_PATH)\misc.obj \
|
$(OBJ_PATH)\oglmisc.obj \
|
||||||
$(OBJ_PATH)\divided.obj \
|
$(OBJ_PATH)\divided.obj \
|
||||||
$(OBJ_PATH)\constrnt.obj\
|
$(OBJ_PATH)\constrnt.obj\
|
||||||
$(OBJ_PATH)\composit.obj \
|
$(OBJ_PATH)\composit.obj \
|
||||||
@ -34,7 +34,7 @@ $(OBJ_PATH)\basic2.obj : basic2.cpp
|
|||||||
$(OBJ_PATH)\canvas.obj : canvas.cpp
|
$(OBJ_PATH)\canvas.obj : canvas.cpp
|
||||||
$(OBJ_PATH)\ogldiag.obj : ogldiag.cpp
|
$(OBJ_PATH)\ogldiag.obj : ogldiag.cpp
|
||||||
$(OBJ_PATH)\lines.obj : lines.cpp
|
$(OBJ_PATH)\lines.obj : lines.cpp
|
||||||
$(OBJ_PATH)\misc.obj : misc.cpp
|
$(OBJ_PATH)\oglmisc.obj : oglmisc.cpp
|
||||||
$(OBJ_PATH)\divided.obj : divided.cpp
|
$(OBJ_PATH)\divided.obj : divided.cpp
|
||||||
$(OBJ_PATH)\constrnt.obj: constrnt.cpp
|
$(OBJ_PATH)\constrnt.obj: constrnt.cpp
|
||||||
$(OBJ_PATH)\composit.obj : composit.cpp
|
$(OBJ_PATH)\composit.obj : composit.cpp
|
||||||
|
@ -14,7 +14,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
LIBTARGET=$(WXDIR)\lib\ogl.lib
|
LIBTARGET=$(WXDIR)\lib\ogl.lib
|
||||||
|
|
||||||
OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\
|
OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj oglmisc.obj divided.obj constrnt.obj\
|
||||||
composit.obj drawn.obj bmpshape.obj mfutils.obj
|
composit.obj drawn.obj bmpshape.obj mfutils.obj
|
||||||
|
|
||||||
!include $(WXDIR)\src\makelib.bcc
|
!include $(WXDIR)\src\makelib.bcc
|
||||||
|
@ -27,7 +27,7 @@ INC = /I$(WXDIR)\include /I$(WXDIR)\contrib\include
|
|||||||
# to disable PROLOGIO-dependent code
|
# to disable PROLOGIO-dependent code
|
||||||
OPTIONS = -DPROLOGIO
|
OPTIONS = -DPROLOGIO
|
||||||
|
|
||||||
OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\
|
OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj oglmisc.obj divided.obj constrnt.obj\
|
||||||
composit.obj drawn.obj bitmap.obj mfutils.obj
|
composit.obj drawn.obj bitmap.obj mfutils.obj
|
||||||
|
|
||||||
all: $(GRAPHICSLIB)
|
all: $(GRAPHICSLIB)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
WXDIR = ../../..
|
WXDIR = ../../..
|
||||||
|
|
||||||
LIBTARGET=$(WXDIR)/lib/libogl.a
|
LIBTARGET=$(WXDIR)/lib/libogl.a
|
||||||
OBJECTS = basic.o basic2.o canvas.o ogldiag.o lines.o misc.o divided.o constrnt.o\
|
OBJECTS = basic.o basic2.o canvas.o ogldiag.o lines.o oglmisc.o divided.o constrnt.o\
|
||||||
composit.o drawn.o bmpshape.o mfutils.o
|
composit.o drawn.o bmpshape.o mfutils.o
|
||||||
|
|
||||||
include $(WXDIR)/src/makelib.g95
|
include $(WXDIR)/src/makelib.g95
|
||||||
|
@ -19,7 +19,7 @@ LIB_CPP_SRC=\
|
|||||||
canvas.o\
|
canvas.o\
|
||||||
ogldiag.o\
|
ogldiag.o\
|
||||||
lines.o\
|
lines.o\
|
||||||
misc.o\
|
oglmisc.o\
|
||||||
divided.o\
|
divided.o\
|
||||||
constrnt.o\
|
constrnt.o\
|
||||||
composit.o\
|
composit.o\
|
||||||
|
@ -25,7 +25,7 @@ DOCSOURCEDIR=$(WXDIR)\contrib\docs\latex\ogl
|
|||||||
|
|
||||||
PROGRAM=test
|
PROGRAM=test
|
||||||
|
|
||||||
OBJECTS = $(D)\basic.obj $(D)\basic2.obj $(D)\canvas.obj $(D)\ogldiag.obj $(D)\lines.obj $(D)\misc.obj $(D)\divided.obj $(D)\constrnt.obj\
|
OBJECTS = $(D)\basic.obj $(D)\basic2.obj $(D)\canvas.obj $(D)\ogldiag.obj $(D)\lines.obj $(D)\oglmisc.obj $(D)\divided.obj $(D)\constrnt.obj\
|
||||||
$(D)\composit.obj $(D)\drawn.obj $(D)\bmpshape.obj $(D)\mfutils.obj
|
$(D)\composit.obj $(D)\drawn.obj $(D)\bmpshape.obj $(D)\mfutils.obj
|
||||||
|
|
||||||
LIBTARGET=$(WXDIR)\lib\ogl$(LIBEXT).lib
|
LIBTARGET=$(WXDIR)\lib\ogl$(LIBEXT).lib
|
||||||
@ -82,7 +82,7 @@ $(D)\lines.obj: lines.$(SRCSUFF) $(OGLINC)/basic.h $(OGLINC)/misc.h $(OGLIN
|
|||||||
$(CPPFLAGS) /c /Fo$@ /Tp $(*B).$(SRCSUFF)
|
$(CPPFLAGS) /c /Fo$@ /Tp $(*B).$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
$(D)\misc.obj: misc.$(SRCSUFF) $(OGLINC)/basic.h $(OGLINC)/misc.h $(OGLINC)/constrnt.h $(OGLINC)/basicp.h
|
$(D)\oglmisc.obj: oglmisc.$(SRCSUFF) $(OGLINC)/basic.h $(OGLINC)/misc.h $(OGLINC)/constrnt.h $(OGLINC)/basicp.h
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /c /Fo$@ /Tp $(*B).$(SRCSUFF)
|
$(CPPFLAGS) /c /Fo$@ /Tp $(*B).$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
@ -64,12 +64,12 @@ void wxOGLInitialize()
|
|||||||
|
|
||||||
g_oglNormalFont = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL);
|
g_oglNormalFont = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL);
|
||||||
|
|
||||||
g_oglBlackPen = new wxPen("BLACK", 1, wxSOLID);
|
g_oglBlackPen = new wxPen(wxT("BLACK"), 1, wxSOLID);
|
||||||
|
|
||||||
g_oglWhiteBackgroundPen = new wxPen("WHITE", 1, wxSOLID);
|
g_oglWhiteBackgroundPen = new wxPen(wxT("WHITE"), 1, wxSOLID);
|
||||||
g_oglTransparentPen = new wxPen("WHITE", 1, wxTRANSPARENT);
|
g_oglTransparentPen = new wxPen(wxT("WHITE"), 1, wxTRANSPARENT);
|
||||||
g_oglWhiteBackgroundBrush = new wxBrush("WHITE", wxSOLID);
|
g_oglWhiteBackgroundBrush = new wxBrush(wxT("WHITE"), wxSOLID);
|
||||||
g_oglBlackForegroundPen = new wxPen("BLACK", 1, wxSOLID);
|
g_oglBlackForegroundPen = new wxPen(wxT("BLACK"), 1, wxSOLID);
|
||||||
|
|
||||||
OGLInitializeConstraintTypes();
|
OGLInitializeConstraintTypes();
|
||||||
|
|
||||||
@ -166,16 +166,17 @@ int FontSizeDialog(wxFrame *parent, int old_size)
|
|||||||
{
|
{
|
||||||
if (old_size <= 0)
|
if (old_size <= 0)
|
||||||
old_size = 10;
|
old_size = 10;
|
||||||
char buf[40];
|
wxString buf;
|
||||||
sprintf(buf, "%d", old_size);
|
buf << old_size;
|
||||||
wxString ans = wxGetTextFromUser("Enter point size", "Font size", buf, parent);
|
wxString ans = wxGetTextFromUser(wxT("Enter point size"), wxT("Font size"), buf, parent);
|
||||||
if (ans == "")
|
if (ans.Length() == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int new_size = atoi(ans);
|
long new_size = 0;
|
||||||
|
ans.ToLong(&new_size);
|
||||||
if ((new_size <= 0) || (new_size > 40))
|
if ((new_size <= 0) || (new_size > 40))
|
||||||
{
|
{
|
||||||
wxMessageBox("Invalid point size!", "Error", wxOK);
|
wxMessageBox(wxT("Invalid point size!"), wxT("Error"), wxOK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return new_size;
|
return new_size;
|
||||||
@ -385,24 +386,24 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
|
|||||||
wxStringList word_list;
|
wxStringList word_list;
|
||||||
|
|
||||||
// Make new lines into NULL strings at this point
|
// Make new lines into NULL strings at this point
|
||||||
int i = 0; int j = 0; int len = strlen(text);
|
int i = 0; int j = 0; int len = text.Length();
|
||||||
char word[200]; word[0] = 0;
|
wxChar word[200]; word[0] = 0;
|
||||||
bool end_word = FALSE; bool new_line = FALSE;
|
bool end_word = FALSE; bool new_line = FALSE;
|
||||||
while (i < len)
|
while (i < len)
|
||||||
{
|
{
|
||||||
switch (text[i])
|
switch (text[i])
|
||||||
{
|
{
|
||||||
case '%':
|
case wxT('%'):
|
||||||
{
|
{
|
||||||
i ++;
|
i ++;
|
||||||
if (i == len)
|
if (i == len)
|
||||||
{ word[j] = '%'; j ++; }
|
{ word[j] = wxT('%'); j ++; }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (text[i] == 'n')
|
if (text[i] == wxT('n'))
|
||||||
{ new_line = TRUE; end_word = TRUE; i++; }
|
{ new_line = TRUE; end_word = TRUE; i++; }
|
||||||
else
|
else
|
||||||
{ word[j] = '%'; j ++; word[j] = text[i]; j ++; i ++; }
|
{ word[j] = wxT('%'); j ++; word[j] = text[i]; j ++; i ++; }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -415,7 +416,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
|
|||||||
{
|
{
|
||||||
new_line = TRUE; end_word = TRUE; i++;
|
new_line = TRUE; end_word = TRUE; i++;
|
||||||
}
|
}
|
||||||
case ' ':
|
case wxT(' '):
|
||||||
{
|
{
|
||||||
end_word = TRUE;
|
end_word = TRUE;
|
||||||
i ++;
|
i ++;
|
||||||
@ -445,8 +446,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
|
|||||||
// Now, make a list of strings which can fit in the box
|
// Now, make a list of strings which can fit in the box
|
||||||
wxStringList *string_list = new wxStringList;
|
wxStringList *string_list = new wxStringList;
|
||||||
|
|
||||||
char buffer[400];
|
wxString buffer;
|
||||||
buffer[0] = 0;
|
|
||||||
wxStringListNode *node = word_list.GetFirst();
|
wxStringListNode *node = word_list.GetFirst();
|
||||||
long x, y;
|
long x, y;
|
||||||
|
|
||||||
@ -454,21 +454,21 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
|
|||||||
{
|
{
|
||||||
wxString oldBuffer(buffer);
|
wxString oldBuffer(buffer);
|
||||||
|
|
||||||
char *s = (char *)node->GetData();
|
wxChar *s = (wxChar *)node->GetData();
|
||||||
if (!s)
|
if (!s)
|
||||||
{
|
{
|
||||||
// FORCE NEW LINE
|
// FORCE NEW LINE
|
||||||
if (strlen(buffer) > 0)
|
if (buffer.Length() > 0)
|
||||||
string_list->Add(buffer);
|
string_list->Add(buffer);
|
||||||
|
|
||||||
buffer[0] = 0;
|
buffer.Empty();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (buffer[0] != 0)
|
if (buffer.Length() != 0)
|
||||||
strcat(buffer, " ");
|
buffer += wxT(" ");
|
||||||
|
|
||||||
strcat(buffer, s);
|
buffer += s;
|
||||||
dc.GetTextExtent(buffer, &x, &y);
|
dc.GetTextExtent(buffer, &x, &y);
|
||||||
|
|
||||||
// Don't fit within the bounding box if we're fitting shape to contents
|
// Don't fit within the bounding box if we're fitting shape to contents
|
||||||
@ -478,14 +478,14 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
|
|||||||
if (oldBuffer.Length() > 0)
|
if (oldBuffer.Length() > 0)
|
||||||
string_list->Add(oldBuffer);
|
string_list->Add(oldBuffer);
|
||||||
|
|
||||||
buffer[0] = 0;
|
buffer.Empty();
|
||||||
strcat(buffer, s);
|
buffer += s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
if (buffer[0] != 0)
|
if (buffer.Length() != 0)
|
||||||
string_list->Add(buffer);
|
string_list->Add(buffer);
|
||||||
|
|
||||||
return string_list;
|
return string_list;
|
||||||
@ -813,7 +813,7 @@ void UpdateListBox(wxListBox *item, wxList *list)
|
|||||||
wxNode *node = list->GetFirst();
|
wxNode *node = list->GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
char *s = (char *)node->GetData();
|
wxChar *s = (wxChar *)node->GetData();
|
||||||
item->Append(s);
|
item->Append(s);
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
@ -830,29 +830,32 @@ bool oglRoughlyEqual(double val1, double val2, double tol)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Array used in DecToHex conversion routine.
|
// Array used in DecToHex conversion routine.
|
||||||
static char sg_HexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
|
static wxChar sg_HexArray[] = { wxT('0'), wxT('1'), wxT('2'), wxT('3'),
|
||||||
'C', 'D', 'E', 'F' };
|
wxT('4'), wxT('5'), wxT('6'), wxT('7'),
|
||||||
|
wxT('8'), wxT('9'), wxT('A'), wxT('B'),
|
||||||
|
wxT('C'), wxT('D'), wxT('E'), wxT('F')
|
||||||
|
};
|
||||||
|
|
||||||
// Convert 2-digit hex number to decimal
|
// Convert 2-digit hex number to decimal
|
||||||
unsigned int oglHexToDec(char* buf)
|
unsigned int oglHexToDec(wxChar* buf)
|
||||||
{
|
{
|
||||||
int firstDigit, secondDigit;
|
int firstDigit, secondDigit;
|
||||||
|
|
||||||
if (buf[0] >= 'A')
|
if (buf[0] >= wxT('A'))
|
||||||
firstDigit = buf[0] - 'A' + 10;
|
firstDigit = buf[0] - wxT('A') + 10;
|
||||||
else
|
else
|
||||||
firstDigit = buf[0] - '0';
|
firstDigit = buf[0] - wxT('0');
|
||||||
|
|
||||||
if (buf[1] >= 'A')
|
if (buf[1] >= wxT('A'))
|
||||||
secondDigit = buf[1] - 'A' + 10;
|
secondDigit = buf[1] - wxT('A') + 10;
|
||||||
else
|
else
|
||||||
secondDigit = buf[1] - '0';
|
secondDigit = buf[1] - wxT('0');
|
||||||
|
|
||||||
return firstDigit * 16 + secondDigit;
|
return firstDigit * 16 + secondDigit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert decimal integer to 2-character hex string
|
// Convert decimal integer to 2-character hex string
|
||||||
void oglDecToHex(unsigned int dec, char *buf)
|
void oglDecToHex(unsigned int dec, wxChar *buf)
|
||||||
{
|
{
|
||||||
int firstDigit = (int)(dec/16.0);
|
int firstDigit = (int)(dec/16.0);
|
||||||
int secondDigit = (int)(dec - (firstDigit*16.0));
|
int secondDigit = (int)(dec - (firstDigit*16.0));
|
||||||
@ -865,22 +868,22 @@ void oglDecToHex(unsigned int dec, char *buf)
|
|||||||
wxColour oglHexToColour(const wxString& hex)
|
wxColour oglHexToColour(const wxString& hex)
|
||||||
{
|
{
|
||||||
if (hex.Length() == 6)
|
if (hex.Length() == 6)
|
||||||
{
|
{
|
||||||
char buf[7];
|
long r, g, b;
|
||||||
strncpy(buf, hex, 7);
|
r = g = b = 0;
|
||||||
unsigned int r = oglHexToDec((char *)buf);
|
hex.Mid(0,2).ToLong(&r, 16);
|
||||||
unsigned int g = oglHexToDec((char *)(buf+2));
|
hex.Mid(2,2).ToLong(&g, 16);
|
||||||
unsigned int b = oglHexToDec((char *)(buf+4));
|
hex.Mid(4,2).ToLong(&b, 16);
|
||||||
return wxColour(r, g, b);
|
return wxColour(r, g, b);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return wxColour(0,0,0);
|
return wxColour(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RGB to 3-digit hex
|
// RGB to 3-digit hex
|
||||||
wxString oglColourToHex(const wxColour& colour)
|
wxString oglColourToHex(const wxColour& colour)
|
||||||
{
|
{
|
||||||
char buf[7];
|
wxChar buf[7];
|
||||||
unsigned int red = colour.Red();
|
unsigned int red = colour.Red();
|
||||||
unsigned int green = colour.Green();
|
unsigned int green = colour.Green();
|
||||||
unsigned int blue = colour.Blue();
|
unsigned int blue = colour.Blue();
|
||||||
|
Loading…
Reference in New Issue
Block a user