summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qstatictext.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qstatictext.h')
-rw-r--r--src/gui/text/qstatictext.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index d7771e0..3d59d6a 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -44,6 +44,7 @@
#include <QtCore/qstring.h>
#include <QtGui/qfont.h>
+#include <QtCore/qsize.h>
QT_BEGIN_HEADER
td class='mode'>-rw-r--r--src/docparser.cpp18
-rw-r--r--src/doctokenizer.l5
-rw-r--r--src/doxygen.cpp118
-rw-r--r--src/ftvhelp.cpp24
-rw-r--r--src/ftvhelp.h4
-rw-r--r--src/htmldocvisitor.cpp2
-rw-r--r--src/index.cpp2
-rw-r--r--src/latexgen.cpp95
-rw-r--r--src/memberdef.cpp2
-rw-r--r--src/pre.l23
-rw-r--r--src/scanner.l5
-rw-r--r--src/translator_cz.h22
-rw-r--r--src/translator_hr.h49
-rw-r--r--src/translator_jp.h35
-rw-r--r--src/translator_pl.h332
-rw-r--r--src/translator_ru.h43
-rw-r--r--src/util.cpp46
-rw-r--r--src/util.h1
19 files changed, 516 insertions, 335 deletions
diff --git a/src/config.l b/src/config.l
index dfc763f..67b1f62 100644
--- a/src/config.l
+++ b/src/config.l
@@ -1362,6 +1362,21 @@ void Config::create()
ce->addValue("Ukrainian");
#endif
cb = addBool(
+ "USE_WINDOWS_ENCODING",
+ "This tag can be used to specify the encoding used in the generated output. \n"
+ "The encoding is not always determined by the language that is chosen, \n"
+ "but also whether or not the output is meant for Windows or non-Windows users. \n"
+ "In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES \n"
+ "forces the Windows enconding, (this is the default for the Windows binary), \n"
+ "whereas setting the tag to NO uses a Unix-style encoding (the default for the \n"
+ "all platforms other than Windows).\n",
+#if defined(_WIN32) || defined(__CYGWIN__)
+ TRUE
+#else
+ FALSE
+#endif
+ );
+ cb = addBool(
"EXTRACT_ALL",
"If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in \n"
"documentation are documented, even if no documentation was available. \n"
@@ -1975,7 +1990,7 @@ void Config::create()
"If the GENERATE_TREEVIEW tag is set to YES, a side panel will be\n"
"generated containing a tree-like index structure (just like the one that \n"
"is generated for HTML Help). For this to work a browser that supports \n"
- "JavaScript, DHTML, CSS and frames is required (for instance Mozilla, \n"
+ "JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, \n"
"Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are \n"
"probably better off using the HTML help feature. \n",
FALSE
@@ -2087,6 +2102,14 @@ void Config::create()
FALSE
);
cb->addDependency("GENERATE_LATEX");
+ cb = addBool(
+ "LATEX_HIDE_INDICES",
+ "If LATEX_HIDE_INDICES is set to YES then doxygen will not \n"
+ "include the index chapters (such as File Index, Compound Index, etc.) \n"
+ "in the output. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_LATEX");
//-----------------------------------------------------------------------------------------------
addInfo( "RTF","configuration options related to the RTF output");
//-----------------------------------------------------------------------------------------------
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 4657ae5..846d19c 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -562,11 +562,11 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children,
{
case TK_COMMAND:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: Illegal command \\%s as the argument of a \\%s command",
- tokenName.data(),cmdName.data());
+ g_token->name.data(),cmdName.data());
break;
case TK_SYMBOL:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: Unsupported symbol %s found",
- tokenName.data());
+ g_token->name.data());
break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: Unexpected token %s",
@@ -688,8 +688,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children)
{
Definition *compound=0;
MemberDef *member=0;
- QString name = g_token->name;
- if (name.at(0)=='#') name=name.right(name.length()-1);
+ QString name = linkToText(g_token->name);
if (resolveRef(g_context,g_token->name,g_inSeeBlock,&compound,&member))
{
if (member) // member link
@@ -1615,7 +1614,7 @@ DocRef::DocRef(DocNode *parent,const QString &target) :
}
else if (resolveLink(g_context,target,TRUE,&compound,&pageInfo,anchor))
{
- m_text = target;
+ m_text = linkToText(target);
m_anchor = anchor;
if (pageInfo) // ref to page
{
@@ -3526,7 +3525,14 @@ int DocPara::handleCommand(const QString &cmdName)
{
doctokenizerYYsetStateCode();
retval = doctokenizerYYlex();
- m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Code,g_isExample,g_fileName));
+ // search for the first non-whitespace line, index is stored in li
+ int i=0,li=0,l=g_token->verb.length();
+ while (i<l && g_token->verb.at(i)==' ' || g_token->verb.at(i)=='\n')
+ {
+ if (g_token->verb.at(i)=='\n') li=i+1;
+ i++;
+ }
+ m_children.append(new DocVerbatim(this,g_context,g_token->verb.mid(li),DocVerbatim::Code,g_isExample,g_fileName));
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: code section ended without end marker");
doctokenizerYYsetStatePara();
}
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index 70a66f5..f8f363a 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -487,7 +487,7 @@ LABELID [a-z_A-Z][a-z_A-Z0-9\-]*
return TK_NEWPARA;
}
}
-<St_Code>{CMD}"endcode" {
+<St_Code>{WS}*{CMD}"endcode" {
return RetVal_OK;
}
<St_Code>[^\\@\n]+ |
@@ -603,11 +603,12 @@ LABELID [a-z_A-Z][a-z_A-Z0-9\-]*
return 0;
}
-<St_Ref>({ID}[.-])*{ID} {
+<St_Ref>("#"|"::")?({ID}[.#:-])*{ID} {
g_token->name=yytext;
return TK_WORD;
}
<St_Ref>{BLANK}+ {
+ unput(' ');
return 0;
}
<St_Ref>{BLANK}+"\"" {
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index ebd8182..f25adf4 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -235,83 +235,110 @@ static void addRelatedPage(Entry *root)
}
-static void buildGroupList(Entry *root)
+static void buildGroupListFiltered(Entry *root,bool additional)
{
if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty())
{
- //printf("Found group %s title=`%s'\n",root->name.data(),root->type.data());
-
- GroupDef *gd;
+ //printf("Found group %s title=`%s type=%d'\n",
+ // root->name.data(),root->type.data(),root->groupDocType);
- if ((gd=Doxygen::groupSDict[root->name]))
+ if ((root->groupDocType==Entry::GROUPDOC_NORMAL && !additional) ||
+ (root->groupDocType!=Entry::GROUPDOC_NORMAL && additional))
{
- if ( root->groupDocType==Entry::GROUPDOC_NORMAL )
+ GroupDef *gd;
+
+ if ((gd=Doxygen::groupSDict[root->name]))
{
- warn(root->fileName,root->startLine,
- "Warning: group %s already documented. "
- "Skipping documentation.",
- root->name.data());
+ if ( root->groupDocType==Entry::GROUPDOC_NORMAL )
+ {
+ warn(root->fileName,root->startLine,
+ "Warning: group %s already documented. "
+ "Skipping documentation.",
+ root->name.data());
+ }
+ else
+ {
+ if ( !gd->hasGroupTitle() )
+ gd->setGroupTitle( root->type );
+ else if ( root->type.length() > 0 && root->name != root->type && gd->groupTitle() != root->type )
+ warn( root->fileName,root->startLine,
+ "group %s: ignoring title \"%s\" that does not match old title \"%s\"\n",
+ root->name.data(), root->type.data(), gd->groupTitle() );
+ if ( gd->briefDescription().isEmpty() )
+ gd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
+ if ( !root->doc.stripWhiteSpace().isEmpty() )
+ gd->setDocumentation( gd->documentation().isEmpty() ? root->doc :
+ gd->documentation() + "\n\n" + root->doc,
+ root->docFile, root->docLine );
+ gd->addSectionsToDefinition(root->anchors);
+ gd->setRefItems(root->sli);
+ //addGroupToGroups(root,gd);
+ }
}
else
{
- if ( !gd->hasGroupTitle() )
- gd->setGroupTitle( root->type );
- else if ( root->type.length() > 0 && root->name != root->type && gd->groupTitle() != root->type )
- warn( root->fileName,root->startLine,
- "group %s: ignoring title \"%s\" that does not match old title \"%s\"\n",
- root->name.data(), root->type.data(), gd->groupTitle() );
- if ( gd->briefDescription().isEmpty() )
- gd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
- if ( !root->doc.stripWhiteSpace().isEmpty() )
- gd->setDocumentation( gd->documentation().isEmpty() ? root->doc :
- gd->documentation() + "\n\n" + root->doc,
- root->docFile, root->docLine );
+ gd = new GroupDef(root->fileName,root->startLine,root->name,root->type);
+ if (root->tagInfo)
+ {
+ gd->setReference(root->tagInfo->tagName);
+ }
+ gd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
+ gd->setDocumentation(root->doc,root->docFile,root->docLine);
gd->addSectionsToDefinition(root->anchors);
+ Doxygen::groupSDict.append(root->name,gd);
gd->setRefItems(root->sli);
- addGroupToGroups(root,gd);
- }
- }
- else
- {
- gd = new GroupDef(root->fileName,root->startLine,root->name,root->type);
- if (root->tagInfo)
- {
- gd->setReference(root->tagInfo->tagName);
}
- gd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
- gd->setDocumentation(root->doc,root->docFile,root->docLine);
- gd->addSectionsToDefinition(root->anchors);
- Doxygen::groupSDict.append(root->name,gd);
- gd->setRefItems(root->sli);
}
}
EntryListIterator eli(*root->sublist);
Entry *e;
for (;(e=eli.current());++eli)
{
- buildGroupList(e);
+ buildGroupListFiltered(e,additional);
}
}
-static void organizeSubGroups(Entry *root)
+static void buildGroupList(Entry *root)
+{
+ // first process the @defgroups blocks
+ buildGroupListFiltered(root,FALSE);
+ // then process the @addtogroup, @weakgroup blocks
+ buildGroupListFiltered(root,TRUE);
+}
+
+static void organizeSubGroupsFiltered(Entry *root,bool additional)
{
if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty())
{
- GroupDef *gd;
-
- if ((gd=Doxygen::groupSDict[root->name]))
+ if ((root->groupDocType==Entry::GROUPDOC_NORMAL && !additional) ||
+ (root->groupDocType!=Entry::GROUPDOC_NORMAL && additional))
{
- addGroupToGroups(root,gd);
+ GroupDef *gd;
+ if ((gd=Doxygen::groupSDict[root->name]))
+ {
+ //printf("adding %s to group %s\n",root->name.data(),gd->name().data());
+ addGroupToGroups(root,gd);
+ }
}
}
EntryListIterator eli(*root->sublist);
Entry *e;
for (;(e=eli.current());++eli)
{
- organizeSubGroups(e);
+ organizeSubGroupsFiltered(e,additional);
}
}
+static void organizeSubGroups(Entry *root)
+{
+ //printf("Defining groups\n");
+ // first process the @defgroups blocks
+ organizeSubGroupsFiltered(root,FALSE);
+ //printf("Additional groups\n");
+ // then process the @addtogroup, @weakgroup blocks
+ organizeSubGroupsFiltered(root,TRUE);
+}
+
//----------------------------------------------------------------------
static void buildFileList(Entry *root)
@@ -1599,6 +1626,7 @@ static bool isVarWithConstructor(Entry *root)
static QRegExp idChars("[a-z_A-Z][a-z_A-Z0-9]*");
bool result=FALSE;
bool typeIsClass;
+ QCString type;
Definition *ctx = 0;
FileDef *fd = 0;
bool ambig;
@@ -1620,7 +1648,9 @@ static bool isVarWithConstructor(Entry *root)
goto done;
}
if (root->parent->name) ctx=Doxygen::namespaceSDict.find(root->parent->name);
- typeIsClass=getResolvedClass(ctx,root->type)!=0;
+ type = root->type;
+ if (type.left(6)=="const ") type=type.right(type.length()-6);
+ typeIsClass=getResolvedClass(ctx,type)!=0;
if (typeIsClass) // now we still have to check if the arguments are
// types or values. Since we do not have complete type info
// we need to rely on heuristics :-(
diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp
index 0ed9565..c010692 100644
--- a/src/ftvhelp.cpp
+++ b/src/ftvhelp.cpp
@@ -471,7 +471,7 @@ FTVHelp::FTVHelp()
{
/* initial depth */
//m_dc = 0;
- m_cf = 0;
+ //m_cf = 0;
m_indentNodes = new QList<FTVNode>[MAX_INDENT];
m_indentNodes[0].setAutoDelete(TRUE);
m_indent=0;
@@ -495,6 +495,7 @@ FTVHelp *FTVHelp::getInstance()
*/
void FTVHelp::initialize()
{
+#if 0
/* open the contents file */
QCString fName = Config_getString("HTML_OUTPUT") + "/tree.js";
m_cf = new QFile(fName);
@@ -519,6 +520,7 @@ void FTVHelp::initialize()
m_cts << Config_getString("PROJECT_NAME");
}
m_cts << "</b>\", \"\", \"\")\n";
+#endif
}
/*! Finalizes the FTV help. This will finish and close the
@@ -527,9 +529,9 @@ void FTVHelp::initialize()
*/
void FTVHelp::finalize()
{
- m_cts.unsetDevice();
- m_cf->close();
- delete m_cf;
+ //m_cts.unsetDevice();
+ //m_cf->close();
+ //delete m_cf;
generateTreeView();
//generateFolderTreeViewData();
}
@@ -690,6 +692,8 @@ void FTVHelp::generateIndent(QTextStream &t, FTVNode *n,int level)
void FTVHelp::generateLink(QTextStream &t,FTVNode *n)
{
QCString *dest;
+ //printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n",
+ // n->ref.data(),n->file.data(),n->anchor.data());
if (!n->ref.isEmpty()) // link to entity imported via tag file
{
t << "<a class=\"elRef\" ";
@@ -920,7 +924,17 @@ void FTVHelp::generateTreeView()
t << "\n";
t << " <body bgcolor=\"#ffffff\">\n";
t << " <div class=\"directory\">\n";
- t << " <h3>Root</h3>\n";
+ t << " <h3>";
+ QCString &projName = Config_getString("PROJECT_NAME");
+ if (projName.isEmpty())
+ {
+ t << "Root";
+ }
+ else
+ {
+ t << projName;
+ }
+ t << "</h3>\n";
t << " <div style=\"display: block;\">\n";
generateTree(t,m_indentNodes[0],0);
diff --git a/src/ftvhelp.h b/src/ftvhelp.hdiv>
+ * macosx/tkMacOSXButton.c: #include new tkMacOSXPrivate.h
+ * macosx/tkMacOSXCarbonEvents.c: instead of tkMacOSXInt.h.
+ * macosx/tkMacOSXClipboard.c:
+ * macosx/tkMacOSXColor.c:
+ * macosx/tkMacOSXCursor.c:
+ * macosx/tkMacOSXDebug.c:
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXHLEvents.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXNotify.c:
+ * macosx/tkMacOSXRegion.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+
2007-06-23 Daniel Steffen <das@users.sourceforge.net>
* generic/tkImgPhoto.c (ImgPhotoConfigureInstance, DisposeInstance):
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 76906e7..edd641a 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -11,10 +11,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXButton.c,v 1.2.2.17 2007/05/31 13:42:11 das Exp $
+ * RCS: @(#) $Id: tkMacOSXButton.c,v 1.2.2.18 2007/06/29 03:22:00 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkButton.h"
#include "tkMacOSXFont.h"
#include "tkMacOSXDebug.h"
@@ -789,8 +789,7 @@ TkMacOSXInitControl(
SInt32 controlReference;
rootControl = TkMacOSXGetRootControl(Tk_WindowId(butPtr->tkwin));
- mbPtr->windowRef = GetWindowFromPort(
- TkMacOSXGetDrawablePort(Tk_WindowId(butPtr->tkwin)));
+ mbPtr->windowRef = TkMacOSXDrawableWindow(Tk_WindowId(butPtr->tkwin));
/*
* Set up the user pane.
@@ -1238,9 +1237,11 @@ UserPaneDraw(
{
MacButton *mbPtr = (MacButton *)(intptr_t)GetControlReference(control);
Rect contrlRect;
-
+ CGrafPtr port;
+
+ GetPort(&port);
GetControlBounds(control,&contrlRect);
- TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL);
+ TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL, port);
EraseRect(&contrlRect);
}
@@ -1269,7 +1270,10 @@ UserPaneBackgroundProc(
MacButton * mbPtr = (MacButton *)(intptr_t)GetControlReference(control);
if (info->colorDevice) {
- TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL);
+ CGrafPtr port;
+
+ GetPort(&port);
+ TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL, port);
}
}
diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c
index f95dec2..afdcb5f 100644
--- a/macosx/tkMacOSXCarbonEvents.c
+++ b/macosx/tkMacOSXCarbonEvents.c
@@ -60,10 +60,10 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.16 2007/04/29 02:26:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.17 2007/06/29 03:22:01 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkMacOSXEvent.h"
#include "tkMacOSXDebug.h"
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c
index 8009173..ceb3bbf 100644
--- a/macosx/tkMacOSXClipboard.c
+++ b/macosx/tkMacOSXClipboard.c
@@ -10,10 +10,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.2.2.6 2007/04/29 02:26:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.2.2.7 2007/06/29 03:22:01 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkSelect.h"
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 381655f..1bf9542 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -13,10 +13,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.8 2007/06/09 17:10:20 das Exp $
+ * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.9 2007/06/29 03:22:01 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkColor.h"
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
@@ -198,8 +198,11 @@ static const struct SystemColorMapEntry systemColorMap[] = {
*/
static int
-GetThemeFromPixelCode(unsigned char code, ThemeBrush *brush,
- ThemeTextColor *textColor, ThemeBackgroundKind *background)
+GetThemeFromPixelCode(
+ unsigned char code,
+ ThemeBrush *brush,
+ ThemeTextColor *textColor,
+ ThemeBackgroundKind *background)
{
if (code >= MIN_PIXELCODE && code <= MAX_PIXELCODE && code != PIXEL_MAGIC) {
*brush = systemColorMap[code - MIN_PIXELCODE].brush;
@@ -234,8 +237,12 @@ GetThemeFromPixelCode(unsigned char code, ThemeBrush *brush,
*/
static OSStatus
-GetThemeColor(unsigned long pixel, ThemeBrush brush, ThemeTextColor textColor,
- ThemeBackgroundKind background, RGBColor *c)
+GetThemeColor(
+ unsigned long pixel,
+ ThemeBrush brush,
+ ThemeTextColor textColor,
+ ThemeBackgroundKind background,
+ RGBColor *c)
{
OSStatus err = noErr;
@@ -308,25 +315,32 @@ TkSetMacColor(
*/
void
-TkMacOSXSetColorInPort(unsigned long pixel, int fg, PixPatHandle penPat)
+TkMacOSXSetColorInPort(
+ unsigned long pixel,
+ int fg,
+ PixPatHandle penPat,
+ CGrafPtr port)
{
OSStatus err;
RGBColor c;
ThemeBrush brush;
ThemeTextColor textColor;
ThemeBackgroundKind background;
+ int setPenPat = 0;
if (GetThemeFromPixelCode((pixel >> 24) & 0xff, &brush, &textColor,
&background)) {
- CGrafPtr port;
+ CGrafPtr savePort;
+ Boolean portChanged;
- GetPort(&port);
+ portChanged = QDSwapPort(port, &savePort);
err = ChkErr(GetThemeColor, pixel, brush, textColor, background, &c);
if (err == noErr) {
if (fg) {
RGBForeColor(&c);
if (penPat) {
MakeRGBPat(penPat, &c);
+ setPenPat = 1;
}
} else {
RGBBackColor(&c);
@@ -346,9 +360,16 @@ TkMacOSXSetColorInPort(unsigned long pixel, int fg, PixPatHandle penPat)
err = ChkErr(ApplyThemeBackground, background, &bounds,
kThemeStateActive, 32, true);
}
- if (penPat && err == noErr && !textColor) {
+ if (penPat && err == noErr && (brush || background)) {
GetPortBackPixPat(port, penPat);
+ setPenPat = 1;
}
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ }
+ if (penPat && !setPenPat) {
+ GetPortBackPixPat(port, penPat);
}
}
@@ -372,7 +393,9 @@ TkMacOSXSetColorInPort(unsigned long pixel, int fg, PixPatHandle penPat)
*/
void
-TkMacOSXSetColorInContext(unsigned long pixel, CGContextRef context)
+TkMacOSXSetColorInContext(
+ unsigned long pixel,
+ CGContextRef context)
{
OSStatus err = -1;
RGBColor c;
@@ -447,7 +470,7 @@ TkMacOSXSetColorInContext(unsigned long pixel, CGContextRef context)
) TK_ENDIF
}
portChanged = QDSwapPort(patGWorld, &savePort);
- TkMacOSXSetColorInPort(pixel, 1, pixpat);
+ TkMacOSXSetColorInPort(pixel, 1, pixpat, patGWorld);
#ifdef TK_MAC_DEBUG
Rect patBounds;
GetPixBounds((**pixpat).patMap, &patBounds);
diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c
index 81fe11d..09ae0cd 100644
--- a/macosx/tkMacOSXCursor.c
+++ b/macosx/tkMacOSXCursor.c
@@ -10,10 +10,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXCursor.c,v 1.4.2.5 2007/04/29 02:26:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXCursor.c,v 1.4.2.6 2007/06/29 03:22:01 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
/*
* There are three different ways to set the cursor on the Mac.
diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c
index fccc8bb..88d23f4 100644
--- a/macosx/tkMacOSXDebug.c
+++ b/macosx/tkMacOSXDebug.c
@@ -54,10 +54,10 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.2.2.12 2007/05/30 06:39:37 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.2.2.13 2007/06/29 03:22:01 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkMacOSXDebug.h"
#ifdef TK_MAC_DEBUG
@@ -455,17 +455,21 @@ TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char * buf)
MODULE_SCOPE void
TkMacOSXDebugFlashRegion(
- CGrafPtr port,
+ Drawable d,
RgnHandle rgn)
{
TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion,
CGrafPtr port, RgnHandle region);
- if (port && rgn && QDDebugFlashRegion) {
- /*
- * Carbon-internal region flashing SPI (c.f. Technote 2124)
- */
+ if (d && rgn && QDDebugFlashRegion && !EmptyRgn(rgn)) {
+ CGrafPtr port = TkMacOSXGetDrawablePort(d);
- QDDebugFlashRegion(port, rgn);
+ if (port) {
+ /*
+ * Carbon-internal region flashing SPI (c.f. Technote 2124)
+ */
+
+ QDDebugFlashRegion(port, rgn);
+ }
}
}
diff --git a/macosx/tkMacOSXDebug.h b/macosx/tkMacOSXDebug.h
index b25d3d9..5798898 100644
--- a/macosx/tkMacOSXDebug.h
+++ b/macosx/tkMacOSXDebug.h
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.2.2.9 2007/05/30 06:39:37 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.2.2.10 2007/06/29 03:22:01 das Exp $
*/
#ifndef _TKMACDEBUG
@@ -82,7 +82,7 @@ MODULE_SCOPE char* TkMacOSXMenuMessageToAscii(int msg, char * s);
MODULE_SCOPE char* TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char * buf );
#endif
-MODULE_SCOPE void TkMacOSXDebugFlashRegion(CGrafPtr port, RgnHandle rgn);
+MODULE_SCOPE void TkMacOSXDebugFlashRegion(Drawable d, RgnHandle rgn);
MODULE_SCOPE void* TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol);
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index b28b444..b0aff20 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -10,10 +10,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.4.2.15 2007/06/23 00:27:11 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.4.2.16 2007/06/29 03:22:01 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkFileFilter.h"
#ifndef StrLength
@@ -774,8 +774,7 @@ NavServicesGetFile(
options.modality = kWindowModalityAppModal;
if (parent && ((TkWindow*)parent)->window != None &&
TkMacOSXHostToplevelExists(parent)) {
- options.parentWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(
- Tk_WindowId(parent)));
+ options.parentWindow = TkMacOSXDrawableWindow(Tk_WindowId(parent));
TK_IF_HI_TOOLBOX (5,
/*
* Impossible to modify dialog modality with the Cocoa-based
@@ -1570,8 +1569,7 @@ Tk_MessageBoxObjCmd(
if (!handler) {
handler = NewEventHandlerUPP(AlertHandler);
}
- windowRef = GetWindowFromPort(TkMacOSXGetDrawablePort(
- Tk_WindowId(tkwin)));
+ windowRef = TkMacOSXDrawableWindow(Tk_WindowId(tkwin));
if (!windowRef) {
goto end;
}
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 8aee6de..6809be1 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -12,10 +12,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.26 2007/06/09 17:10:20 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.27 2007/06/29 03:22:01 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkMacOSXDebug.h"
#include "tclInt.h" /* for Tcl_CreateNamespace() */
@@ -35,17 +35,17 @@
#define NON_AA_CG_OFFSET .999
/*
- * Temporary regions that can be reused.
+ * Temporary region that can be reused.
*/
-RgnHandle tkMacOSXtmpRgn1 = NULL;
-RgnHandle tkMacOSXtmpRgn2 = NULL;
+RgnHandle tkMacOSXtmpQdRgn = NULL;
+
+int tkMacOSXUseCGDrawing = 1;
static PixPatHandle penPat = NULL;
-static int useCGDrawing = 1;
-static int tkMacOSXCGAntiAliasLimit = 0;
-#define notAA(w) ((w) < tkMacOSXCGAntiAliasLimit)
+static int cgAntiAliasLimit = 0;
+#define notAA(w) ((w) < cgAntiAliasLimit)
static int useThemedToplevel = 0;
static int useThemedFrame = 0;
@@ -89,16 +89,16 @@ TkMacOSXInitCGDrawing(
Tcl_ResetResult(interp);
}
if (Tcl_LinkVar(interp, "::tk::mac::useCGDrawing",
- (char *) &useCGDrawing, TCL_LINK_BOOLEAN) != TCL_OK) {
+ (char *) &tkMacOSXUseCGDrawing, TCL_LINK_BOOLEAN) != TCL_OK) {
Tcl_ResetResult(interp);
}
- useCGDrawing = enable;
+ tkMacOSXUseCGDrawing = enable;
if (Tcl_LinkVar(interp, "::tk::mac::CGAntialiasLimit",
- (char *) &tkMacOSXCGAntiAliasLimit, TCL_LINK_INT) != TCL_OK) {
+ (char *) &cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) {
Tcl_ResetResult(interp);
}
- tkMacOSXCGAntiAliasLimit = limit;
+ cgAntiAliasLimit = limit;
/*
* Piggy-back the themed drawing var init here.
@@ -113,11 +113,8 @@ TkMacOSXInitCGDrawing(
Tcl_ResetResult(interp);
}
- if (tkMacOSXtmpRgn1 == NULL) {
- tkMacOSXtmpRgn1 = NewRgn();
- }
- if (tkMacOSXtmpRgn2 == NULL) {
- tkMacOSXtmpRgn2 = NewRgn();
+ if (tkMacOSXtmpQdRgn == NULL) {
+ tkMacOSXtmpQdRgn = NewRgn();
}
}
#ifdef TK_MAC_DEBUG_DRAWING
@@ -160,47 +157,37 @@ XCopyArea(
int dest_x, /* Dest X & Y on dest rect. */
int dest_y)
{
- Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ TkMacOSXDrawingContext dc;
MacDrawable *srcDraw = (MacDrawable *) src, *dstDraw = (MacDrawable *) dst;
- CGrafPtr srcPort, destPort, savePort;
- Boolean portChanged;
- const BitMap *srcBit, *dstBit;
- RGBColor origForeColor, origBackColor;
- RGBColor black = {0, 0, 0}, white = {0xffff, 0xffff, 0xffff};
display->request++;
- srcPort = TkMacOSXGetDrawablePort(src);
- destPort = TkMacOSXGetDrawablePort(dst);
- srcBit = GetPortBitMapForCopyBits(srcPort);
- dstBit = GetPortBitMapForCopyBits(destPort);
- SetRect(srcPtr, srcDraw->xOff + src_x, srcDraw->yOff + src_y,
- srcDraw->xOff + src_x + width, srcDraw->yOff + src_y + height);
- TkMacOSXCheckTmpRgnEmpty(2);
- GetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- if (tkPictureIsOpen) {
- dstPtr = srcPtr;
- NoQDClip(destPort);
- } else {
- SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
- dstDraw->xOff + dest_x + width,
- dstDraw->yOff + dest_y + height);
- TkMacOSXSetUpClippingRgn(dst);
+ if (!width || !height) {
+ TkMacOSXDbgMsg("Drawing of emtpy area requested");
+ return;
}
- TkMacOSXCheckTmpRgnEmpty(1);
- ClipToGC(dst, gc, destPort, tkMacOSXtmpRgn1);
- portChanged = QDSwapPort(destPort, &savePort);
- GetPortForeColor(destPort, &origForeColor);
- GetPortBackColor(destPort, &origBackColor);
- RGBForeColor(&black);
- RGBBackColor(&white);
- CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
- RGBForeColor(&origForeColor);
- RGBBackColor(&origBackColor);
- SetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- SetEmptyRgn(tkMacOSXtmpRgn2);
- if (portChanged) {
- QDSwapPort(savePort, NULL);
+ if (!TkMacOSXSetupDrawingContext(dst, gc, 0, &dc)) {
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ CGrafPtr srcPort;
+ const BitMap *srcBit, *dstBit;
+ RGBColor black = {0, 0, 0}, white = {0xffff, 0xffff, 0xffff};
+
+ srcPort = TkMacOSXGetDrawablePort(src);
+ srcBit = GetPortBitMapForCopyBits(srcPort);
+ dstBit = GetPortBitMapForCopyBits(dc.port);
+ SetRect(srcPtr, srcDraw->xOff + src_x, srcDraw->yOff + src_y,
+ srcDraw->xOff + src_x + width, srcDraw->yOff + src_y + height);
+ if (tkPictureIsOpen) {
+ dstPtr = srcPtr;
+ } else {
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
+ }
+ RGBForeColor(&black);
+ RGBBackColor(&white);
+ CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
}
+ TkMacOSXRestoreDrawingContext(&dc);
}
/*
@@ -236,76 +223,66 @@ XCopyPlane(
int dest_y,
unsigned long plane) /* Which plane to copy. */
{
- Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ TkMacOSXDrawingContext dc;
MacDrawable *srcDraw = (MacDrawable *) src, *dstDraw = (MacDrawable *) dst;
- CGrafPtr srcPort, destPort, savePort;
- Boolean portChanged;
- const BitMap *srcBit, *dstBit;
- RGBColor origForeColor, origBackColor;
- TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask;
display->request++;
- srcPort = TkMacOSXGetDrawablePort(src);
- destPort = TkMacOSXGetDrawablePort(dst);
- srcBit = GetPortBitMapForCopyBits(srcPort);
- dstBit = GetPortBitMapForCopyBits(destPort);
- SetRect(srcPtr, srcDraw->xOff + src_x, srcDraw->yOff + src_y,
- srcDraw->xOff + src_x + width, srcDraw->yOff + src_y + height);
- TkMacOSXCheckTmpRgnEmpty(2);
- GetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- if (tkPictureIsOpen) {
- dstPtr = srcPtr;
- NoQDClip(destPort);
- } else {
- SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
- dstDraw->xOff + dest_x + width,
- dstDraw->yOff + dest_y + height);
- TkMacOSXSetUpClippingRgn(dst);
+ if (!width || !height) {
+ TkMacOSXDbgMsg("Drawing of emtpy area requested");
+ return;
}
- TkMacOSXCheckTmpRgnEmpty(1);
- GetPortClipRegion(destPort, tkMacOSXtmpRgn1);
- ClipToGC(dst, gc, destPort, tkMacOSXtmpRgn1);
- SetPortClipRegion(destPort, tkMacOSXtmpRgn1);
- SetEmptyRgn(tkMacOSXtmpRgn1);
- portChanged = QDSwapPort(destPort, &savePort);
- GetPortForeColor(destPort, &origForeColor);
- GetPortBackColor(destPort, &origBackColor);
- TkMacOSXSetColorInPort(gc->foreground, 1, NULL);
- if (!clipPtr || clipPtr->type == TKP_CLIP_REGION) {
- /*
- * Opaque bitmaps.
- */
-
- TkMacOSXSetColorInPort(gc->background, 0, NULL);
- CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
- } else if (clipPtr->type == TKP_CLIP_PIXMAP) {
- if (clipPtr->value.pixmap == src) {
- /*
- * Transparent bitmaps. If it's color we ignore the forecolor.
- */
- short tmode = GetPixDepth(GetPortPixMap(srcPort)) == 1 ?
- srcOr : transparent;
-
- CopyBits(srcBit, dstBit, srcPtr, dstPtr, tmode, NULL);
+ if (plane != 1) {
+ Tcl_Panic("Unexpected plane specified for XCopyPlane");
+ }
+ if (!TkMacOSXSetupDrawingContext(dst, gc, 0, &dc)) {
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ CGrafPtr srcPort;
+ const BitMap *srcBit, *dstBit;
+ TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask;
+
+ srcPort = TkMacOSXGetDrawablePort(src);
+ srcBit = GetPortBitMapForCopyBits(srcPort);
+ dstBit = GetPortBitMapForCopyBits(dc.port);
+ SetRect(srcPtr, srcDraw->xOff + src_x, srcDraw->yOff + src_y,
+ srcDraw->xOff + src_x + width, srcDraw->yOff + src_y + height);
+ if (tkPictureIsOpen) {
+ dstPtr = srcPtr;
} else {
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
+ }
+ TkMacOSXSetColorInPort(gc->foreground, 1, NULL, dc.port);
+ if (!clipPtr || clipPtr->type == TKP_CLIP_REGION) {
/*
- * Two arbitrary bitmaps.
+ * Opaque bitmaps.
*/
- CGrafPtr mskPort = TkMacOSXGetDrawablePort(clipPtr->value.pixmap);
- const BitMap *mskBit = GetPortBitMapForCopyBits(mskPort);
+ TkMacOSXSetColorInPort(gc->background, 0, NULL, dc.port);
+ CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
+ } else if (clipPtr->type == TKP_CLIP_PIXMAP) {
+ if (clipPtr->value.pixmap == src) {
+ /*
+ * Transparent bitmaps. If it's color we ignore the forecolor.
+ */
+ short tmode = GetPixDepth(GetPortPixMap(srcPort)) == 1 ?
+ srcOr : transparent;
- CopyDeepMask(srcBit, mskBit, dstBit, srcPtr, srcPtr, dstPtr,
- srcCopy, NULL);
+ CopyBits(srcBit, dstBit, srcPtr, dstPtr, tmode, NULL);
+ } else {
+ /*
+ * Two arbitrary bitmaps.
+ */
+
+ CGrafPtr mskPort = TkMacOSXGetDrawablePort(clipPtr->value.pixmap);
+ const BitMap *mskBit = GetPortBitMapForCopyBits(mskPort);
+
+ CopyDeepMask(srcBit, mskBit, dstBit, srcPtr, srcPtr, dstPtr,
+ srcCopy, NULL);
+ }
}
}
- RGBForeColor(&origForeColor);
- RGBBackColor(&origBackColor);
- SetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- SetEmptyRgn(tkMacOSXtmpRgn2);
- if (portChanged) {
- QDSwapPort(savePort, NULL);
- }
+ TkMacOSXRestoreDrawingContext(&dc);
}
/*
@@ -340,184 +317,169 @@ TkPutImage(
unsigned int width, /* Same width & height for both */
unsigned int height) /* distination and source. */
{
- Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ TkMacOSXDrawingContext dc;
MacDrawable *dstDraw = (MacDrawable *) d;
- CGrafPtr destPort, savePort;
- Boolean portChanged;
- const BitMap *dstBit;
- RGBColor origForeColor, origBackColor;
- RGBColor black = {0, 0, 0}, white = {0xffff, 0xffff, 0xffff};
- int i, j;
- char *newData = NULL;
- char *dataPtr, *newPtr, *oldPtr;
- int rowBytes = image->bytes_per_line;
- int slices, sliceRowBytes, lastSliceRowBytes, sliceWidth, lastSliceWidth;
display->request++;
- destPort = TkMacOSXGetDrawablePort(d);
- dstBit = GetPortBitMapForCopyBits(destPort);
- SetRect(srcPtr, src_x, src_y, src_x + width, src_y + height);
- TkMacOSXCheckTmpRgnEmpty(2);
- GetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- if (tkPictureIsOpen) {
- dstPtr = srcPtr;
- NoQDClip(destPort);
- } else {
- SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
- dstDraw->xOff + dest_x + width,
- dstDraw->yOff + dest_y + height);
- TkMacOSXSetUpClippingRgn(d);
- }
- TkMacOSXCheckTmpRgnEmpty(1);
- ClipToGC(d, gc, destPort, tkMacOSXtmpRgn1);
- portChanged = QDSwapPort(destPort, &savePort);
- GetPortForeColor(destPort, &origForeColor);
- GetPortBackColor(destPort, &origBackColor);
- RGBForeColor(&black);
- RGBBackColor(&white);
- if (image->obdata) {
- /*
- * Image from XGetImage, copy from containing GWorld directly.
- */
-
- CopyBits(GetPortBitMapForCopyBits(TkMacOSXGetDrawablePort((Drawable)
- image->obdata)), dstBit, srcPtr, dstPtr, srcCopy, NULL);
- } else if (image->depth == 1) {
- /*
- * BW image
- */
-
- const int maxRowBytes = 0x3ffe;
- BitMap bitmap;
- int odd;
-
- if (rowBytes > maxRowBytes) {
- slices = rowBytes / maxRowBytes;
- sliceRowBytes = maxRowBytes;
- lastSliceRowBytes = rowBytes - (slices * maxRowBytes);
- if (!lastSliceRowBytes) {
- slices--;
- lastSliceRowBytes = maxRowBytes;
- }
- sliceWidth = (long) image->width * maxRowBytes / rowBytes;
- lastSliceWidth = image->width - (sliceWidth * slices);
+ if (!TkMacOSXSetupDrawingContext(d, gc, 0, &dc)) {
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ const BitMap *dstBit;
+ RGBColor black = {0, 0, 0}, white = {0xffff, 0xffff, 0xffff};
+ int i, j;
+ char *newData = NULL;
+ char *dataPtr, *newPtr, *oldPtr;
+ int rowBytes = image->bytes_per_line;
+ int slices, sliceRowBytes, lastSliceRowBytes, sliceWidth, lastSliceWidth;
+
+ dstBit = GetPortBitMapForCopyBits(dc.port);
+ SetRect(srcPtr, src_x, src_y, src_x + width, src_y + height);
+ if (tkPictureIsOpen) {
+ dstPtr = srcPtr;
} else {
- slices = 0;
- sliceRowBytes = lastSliceRowBytes = rowBytes;
- sliceWidth = lastSliceWidth = image->width;
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
}
- bitmap.bounds.top = bitmap.bounds.left = 0;
- bitmap.bounds.bottom = (short) image->height;
- dataPtr = image->data;
- do {
- if (slices) {
- bitmap.bounds.right = bitmap.bounds.left + sliceWidth;
- } else {
- sliceRowBytes = lastSliceRowBytes;
- bitmap.bounds.right = bitmap.bounds.left + lastSliceWidth;
- }
- oldPtr = dataPtr;
- odd = sliceRowBytes % 2;
- if (!newData) {
- newData = ckalloc(image->height * (sliceRowBytes+odd));
- }
- newPtr = newData;
- for (i = 0; i < image->height; i++) {
- for (j = 0; j < sliceRowBytes; j++) {
- *newPtr = InvertByte((unsigned char) *oldPtr);
- newPtr++; oldPtr++;
- }
- if (odd) {
- *newPtr++ = 0;
- }
- oldPtr += rowBytes - sliceRowBytes;
- }
- bitmap.baseAddr = newData;
- bitmap.rowBytes = sliceRowBytes + odd;
- CopyBits(&bitmap, dstBit, srcPtr, dstPtr, srcCopy, NULL);
- if (slices) {
- bitmap.bounds.left = bitmap.bounds.right;
- dataPtr += sliceRowBytes;
- }
- } while (slices--);
- ckfree(newData);
- } else {
- /*
- * Color image
- */
+ RGBForeColor(&black);
+ RGBBackColor(&white);
+ if (image->obdata) {
+ /*
+ * Image from XGetImage, copy from containing GWorld directly.
+ */
- const int maxRowBytes = 0x3ffc;
- PixMap pixmap;
-
- pixmap.bounds.left = 0;
- pixmap.bounds.top = 0;
- pixmap.bounds.bottom = (short) image->height;
- pixmap.pixelType = RGBDirect;
- pixmap.pmVersion = baseAddr32; /* 32bit clean */
- pixmap.packType = 0;
- pixmap.packSize = 0;
- pixmap.hRes = 0x00480000;
- pixmap.vRes = 0x00480000;
- pixmap.pixelSize = 32;
- pixmap.cmpCount = 3;
- pixmap.cmpSize = 8;
-#ifdef WORDS_BIGENDIAN
- pixmap.pixelFormat = k32ARGBPixelFormat;
-#else
- pixmap.pixelFormat = k32BGRAPixelFormat;
-#endif
- pixmap.pmTable = NULL;
- pixmap.pmExt = 0;
- if (rowBytes > maxRowBytes) {
- slices = rowBytes / maxRowBytes;
- sliceRowBytes = maxRowBytes;
- lastSliceRowBytes = rowBytes - (slices * maxRowBytes);
- if (!lastSliceRowBytes) {
- slices--;
- lastSliceRowBytes = maxRowBytes;
+ CopyBits(GetPortBitMapForCopyBits(TkMacOSXGetDrawablePort((Drawable)
+ image->obdata)), dstBit, srcPtr, dstPtr, srcCopy, NULL);
+ } else if (image->depth == 1) {
+ /*
+ * BW image
+ */
+
+ const int maxRowBytes = 0x3ffe;
+ BitMap bitmap;
+ int odd;
+
+ if (rowBytes > maxRowBytes) {
+ slices = rowBytes / maxRowBytes;
+ sliceRowBytes = maxRowBytes;
+ lastSliceRowBytes = rowBytes - (slices * maxRowBytes);
+ if (!lastSliceRowBytes) {
+ slices--;
+ lastSliceRowBytes = maxRowBytes;
+ }
+ sliceWidth = (long) image->width * maxRowBytes / rowBytes;
+ lastSliceWidth = image->width - (sliceWidth * slices);
+ } else {
+ slices = 0;
+ sliceRowBytes = lastSliceRowBytes = rowBytes;
+ sliceWidth = lastSliceWidth = image->width;
}
- sliceWidth = (long) image->width * maxRowBytes / rowBytes;
- lastSliceWidth = image->width - (sliceWidth * slices);
+ bitmap.bounds.top = bitmap.bounds.left = 0;
+ bitmap.bounds.bottom = (short) image->height;
dataPtr = image->data;
- newData = (char *) ckalloc(image->height * sliceRowBytes);
do {
if (slices) {
- pixmap.bounds.right = pixmap.bounds.left + sliceWidth;
+ bitmap.bounds.right = bitmap.bounds.left + sliceWidth;
} else {
sliceRowBytes = lastSliceRowBytes;
- pixmap.bounds.right = pixmap.bounds.left + lastSliceWidth;
+ bitmap.bounds.right = bitmap.bounds.left + lastSliceWidth;
}
oldPtr = dataPtr;
+ odd = sliceRowBytes % 2;
+ if (!newData) {
+ newData = ckalloc(image->height * (sliceRowBytes+odd));
+ }
newPtr = newData;
for (i = 0; i < image->height; i++) {
- memcpy(newPtr, oldPtr, sliceRowBytes);
- oldPtr += rowBytes;
- newPtr += sliceRowBytes;
+ for (j = 0; j < sliceRowBytes; j++) {
+ *newPtr = InvertByte((unsigned char) *oldPtr);
+ newPtr++; oldPtr++;
+ }
+ if (odd) {
+ *newPtr++ = 0;
+ }
+ oldPtr += rowBytes - sliceRowBytes;
}
- pixmap.baseAddr = newData;
- pixmap.rowBytes = sliceRowBytes | 0x8000;
- CopyBits((BitMap*) &pixmap, dstBit, srcPtr, dstPtr, srcCopy,
- NULL);
+ bitmap.baseAddr = newData;
+ bitmap.rowBytes = sliceRowBytes + odd;
+ CopyBits(&bitmap, dstBit, srcPtr, dstPtr, srcCopy, NULL);
if (slices) {
- pixmap.bounds.left = pixmap.bounds.right;
+ bitmap.bounds.left = bitmap.bounds.right;
dataPtr += sliceRowBytes;
}
} while (slices--);
ckfree(newData);
} else {
- pixmap.bounds.right = (short) image->width;
- pixmap.baseAddr = image->data;
- pixmap.rowBytes = rowBytes | 0x8000;
- CopyBits((BitMap*) &pixmap, dstBit, srcPtr, dstPtr, srcCopy, NULL);
+ /*
+ * Color image
+ */
+
+ const int maxRowBytes = 0x3ffc;
+ PixMap pixmap;
+
+ pixmap.bounds.left = 0;
+ pixmap.bounds.top = 0;
+ pixmap.bounds.bottom = (short) image->height;
+ pixmap.pixelType = RGBDirect;
+ pixmap.pmVersion = baseAddr32; /* 32bit clean */
+ pixmap.packType = 0;
+ pixmap.packSize = 0;
+ pixmap.hRes = 0x00480000;
+ pixmap.vRes = 0x00480000;
+ pixmap.pixelSize = 32;
+ pixmap.cmpCount = 3;
+ pixmap.cmpSize = 8;
+#ifdef WORDS_BIGENDIAN
+ pixmap.pixelFormat = k32ARGBPixelFormat;
+#else
+ pixmap.pixelFormat = k32BGRAPixelFormat;
+#endif
+ pixmap.pmTable = NULL;
+ pixmap.pmExt = 0;
+ if (rowBytes > maxRowBytes) {
+ slices = rowBytes / maxRowBytes;
+ sliceRowBytes = maxRowBytes;
+ lastSliceRowBytes = rowBytes - (slices * maxRowBytes);
+ if (!lastSliceRowBytes) {
+ slices--;
+ lastSliceRowBytes = maxRowBytes;
+ }
+ sliceWidth = (long) image->width * maxRowBytes / rowBytes;
+ lastSliceWidth = image->width - (sliceWidth * slices);
+ dataPtr = image->data;
+ newData = (char *) ckalloc(image->height * sliceRowBytes);
+ do {
+ if (slices) {
+ pixmap.bounds.right = pixmap.bounds.left + sliceWidth;
+ } else {
+ sliceRowBytes = lastSliceRowBytes;
+ pixmap.bounds.right = pixmap.bounds.left + lastSliceWidth;
+ }
+ oldPtr = dataPtr;
+ newPtr = newData;
+ for (i = 0; i < image->height; i++) {
+ memcpy(newPtr, oldPtr, sliceRowBytes);
+ oldPtr += rowBytes;
+ newPtr += sliceRowBytes;
+ }
+ pixmap.baseAddr = newData;
+ pixmap.rowBytes = sliceRowBytes | 0x8000;
+ CopyBits((BitMap*) &pixmap, dstBit, srcPtr, dstPtr, srcCopy,
+ NULL);
+ if (slices) {
+ pixmap.bounds.left = pixmap.bounds.right;
+ dataPtr += sliceRowBytes;
+ }
+ } while (slices--);
+ ckfree(newData);
+ } else {
+ pixmap.bounds.right = (short) image->width;
+ pixmap.baseAddr = image->data;
+ pixmap.rowBytes = rowBytes | 0x8000;
+ CopyBits((BitMap*) &pixmap, dstBit, srcPtr, dstPtr, srcCopy, NULL);
+ }
}
}
- RGBForeColor(&origForeColor);
- RGBBackColor(&origBackColor);
- SetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- SetEmptyRgn(tkMacOSXtmpRgn2);
- if (portChanged) {
- QDSwapPort(savePort, NULL);
- }
+ TkMacOSXRestoreDrawingContext(&dc);
}
/*
@@ -558,7 +520,7 @@ XDrawLines(
}
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
double prevx, prevy;
double o = (lw % 2) ? .5 : 0;
@@ -628,7 +590,7 @@ XDrawSegments(
int i, lw = gc->line_width;
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
double o = (lw % 2) ? .5 : 0;
for (i = 0; i < nsegments; i++) {
@@ -689,7 +651,7 @@ XFillPolygon(
int i;
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
double prevx, prevy;
double o = (gc->line_width % 2) ? .5 : 0;
@@ -764,7 +726,7 @@ XDrawRectangle(
}
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
CGRect rect;
double o = (lw % 2) ? .5 : 0;
@@ -827,7 +789,7 @@ XDrawRectangles(
int i, lw = gc->line_width;
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
CGRect rect;
double o = (lw % 2) ? .5 : 0;
@@ -887,7 +849,7 @@ XFillRectangles(
int i;
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
CGRect rect;
for (i = 0, rectPtr = rectangles; i < n_rectangles; i++, rectPtr++) {
@@ -950,7 +912,7 @@ XDrawArc(
}
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
CGRect rect;
double o = (lw % 2) ? .5 : 0;
@@ -1032,7 +994,7 @@ XDrawArcs(
int i, lw = gc->line_width;
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
CGRect rect;
double o = (lw % 2) ? .5 : 0;
@@ -1125,7 +1087,7 @@ XFillArc(
}
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
CGRect rect;
double o = (lw % 2) ? .5 : 0, u = 0;
@@ -1239,7 +1201,7 @@ XFillArcs(
int i, lw = gc->line_width;
display->request++;
- if (TkMacOSXSetupDrawingContext(d, gc, useCGDrawing, &dc)) {
+ if (TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
CGRect rect;
double o = (lw % 2) ? .5 : 0, u = 0;
@@ -1383,7 +1345,7 @@ TkScrollWindow(
MacDrawable *destDraw = (MacDrawable *) Tk_WindowId(tkwin);
CGrafPtr destPort, savePort;
Boolean portChanged;
- Rect srcRect, scrollRect;
+ Rect scrollRect;
int result;
RgnHandle rgn = (RgnHandle) damageRgn;
@@ -1397,11 +1359,10 @@ TkScrollWindow(
* destination rects disjoint and non-aligned.
*/
- SetRect(&scrollRect, (short) (destDraw->xOff + x),
- (short) (destDraw->yOff + y),
- (short) (destDraw->xOff + x + width),
- (short) (destDraw->yOff + y + height));
- srcRect = scrollRect;
+ scrollRect.left = destDraw->xOff + x;
+ scrollRect.top = destDraw->yOff + y;
+ scrollRect.right = scrollRect.left + width;
+ scrollRect.bottom = scrollRect.top + height;
if (dx < 0) {
scrollRect.left += dx;
} else {
@@ -1415,19 +1376,6 @@ TkScrollWindow(
destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
- TkMacOSXCheckTmpRgnEmpty(1);
- TkMacOSXCheckTmpRgnEmpty(2);
- RectRgn(rgn, &srcRect);
- GetPortVisibleRegion(destPort,tkMacOSXtmpRgn1);
- DiffRgn(rgn, tkMacOSXtmpRgn1, rgn);
- OffsetRgn(rgn, dx, dy);
- GetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- DiffRgn(tkMacOSXtmpRgn2, rgn, tkMacOSXtmpRgn2);
- SetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- SetEmptyRgn(tkMacOSXtmpRgn2);
- SetEmptyRgn(tkMacOSXtmpRgn1);
- SetEmptyRgn(rgn);
-
portChanged = QDSwapPort(destPort, &savePort);
ScrollRect(&scrollRect, dx, dy, rgn);
if (portChanged) {
@@ -1472,13 +1420,15 @@ TkMacOSXSetUpGraphicsPort(
if (penPat == NULL) {
penPat = NewPixPat();
}
- TkMacOSXSetColorInPort(gc->foreground, 1, penPat);
- PenPixPat(penPat);
+ TkMacOSXSetColorInPort(gc->foreground, 1, penPat, destPort);
+ SetPortPenPixPat(destPort, penPat);
if(gc->function == GXxor) {
- PenMode(patXor);
+ SetPortPenMode(destPort, patXor);
}
if (gc->line_width > 1) {
- PenSize(gc->line_width, gc->line_width);
+ Point s = {gc->line_width, gc->line_width};
+
+ SetPortPenSize(destPort, s);
}
if (gc->line_style != LineSolid) {
/*
@@ -1518,13 +1468,21 @@ TkMacOSXSetupDrawingContext(
Rect portBounds;
dc->saveState = NULL;
+ dc->saveClip = NULL;
dc->penPat = NULL;
dc->portChanged = false;
port = TkMacOSXGetDrawablePort(d);
if (port) {
GetPortBounds(port, &portBounds);
+ dc->saveClip = NewRgn();
+ GetPortClipRegion(port, dc->saveClip);
+ if (tkPictureIsOpen) {
+ NoQDClip(port);
+ } else {
+ TkMacOSXSetUpClippingRgn(d);
+ }
}
- if (context) {
+ if (context && useCG) {
if (!port) {
TK_IF_MAC_OS_X_API (3, CGContextGetClipBoundingBox,
CGRect r = CGContextGetClipBoundingBox(context);
@@ -1535,113 +1493,111 @@ TkMacOSXSetupDrawingContext(
r.origin.y + r.size.height + macDraw->yOff);
) TK_ENDIF
}
- TkMacOSXCheckTmpRgnEmpty(1);
- RectRgn(tkMacOSXtmpRgn1, &portBounds);
- if (port) {
- TkMacOSXSetUpClippingRgn(d);
- SectRegionWithPortClipRegion(port, tkMacOSXtmpRgn1);
- SectRegionWithPortVisibleRegion(port, tkMacOSXtmpRgn1);
- } else if (macDraw->flags & TK_CLIPPED_DRAW) {
- OffsetRgn(macDraw->drawRgn, macDraw->xOff, macDraw->yOff);
- SectRgn(macDraw->clipRgn, macDraw->drawRgn, tkMacOSXtmpRgn1);
- OffsetRgn(macDraw->drawRgn, -macDraw->xOff, -macDraw->yOff);
- }
- ClipToGC(d, gc, NULL, tkMacOSXtmpRgn1);
CGContextSaveGState(context);
dc->saveState = (void*)1;
- ClipCGContextToRegion(context, &portBounds, tkMacOSXtmpRgn1);
- SetEmptyRgn(tkMacOSXtmpRgn1);
port = NULL;
- useCG = 1;
} else if (port) {
dc->portChanged = QDSwapPort(port, &(dc->savePort));
- TkMacOSXSetUpClippingRgn(d);
- if (useCG) {
- if (ChkErr(QDBeginCGContext, port, &context) == noErr) {
- TkMacOSXCheckTmpRgnEmpty(1);
- RectRgn(tkMacOSXtmpRgn1, &portBounds);
- SectRegionWithPortClipRegion(port, tkMacOSXtmpRgn1);
- SectRegionWithPortVisibleRegion(port, tkMacOSXtmpRgn1);
- ClipToGC(d, gc, NULL, tkMacOSXtmpRgn1);
- ClipCGContextToRegion(context, &portBounds, tkMacOSXtmpRgn1);
- SetEmptyRgn(tkMacOSXtmpRgn1);
- SyncCGContextOriginWithPort(context, port);
- } else {
- context = NULL;
- useCG = 0;
- }
+ if (useCG && ChkErr(QDBeginCGContext, port, &context) == noErr) {
+ SyncCGContextOriginWithPort(context, port);
+ } else {
+ context = NULL;
+ useCG = 0;
}
} else {
Tcl_Panic("TkMacOSXSetupDrawingContext(): "
"no port or context to draw into !");
}
if (useCG) {
- CGContextConcatCTM(context, CGAffineTransformMake(1.0, 0.0, 0.0, -1.0,
- 0.0, portBounds.bottom - portBounds.top));
- if (gc) {
- double w = gc->line_width;
-
- TkMacOSXSetColorInContext(gc->foreground, context);
+ if (tkPictureIsOpen) {
+ TkMacOSXDbgMsg("Ignored CG Drawing with QD Picture open");
+ } else if (context) {
+ TkMacOSXCheckTmpQdRgnEmpty();
+ RectRgn(tkMacOSXtmpQdRgn, &portBounds);
if (port) {
- CGContextSetPatternPhase(context, CGSizeMake(portBounds.right -
- portBounds.left, portBounds.bottom - portBounds.top));
- }
- if(gc->function == GXxor) {
- TkMacOSXDbgMsg("GXxor mode not supported for CG drawing!");
- }
- /* When should we antialias? */
- if (notAA(gc->line_width)) {
- /* Make non-antialiased CG drawing look more like X11 */
- w -= (gc->line_width ? NON_AA_CG_OFFSET : 0);
- CGContextSetShouldAntialias(context, 0);
- } else {
- CGContextSetShouldAntialias(context, 1);
+ SectRegionWithPortClipRegion(port, tkMacOSXtmpQdRgn);
+ SectRegionWithPortVisibleRegion(port, tkMacOSXtmpQdRgn);
+ } else if (macDraw->flags & TK_CLIPPED_DRAW) {
+ OffsetRgn(macDraw->drawRgn, macDraw->xOff, macDraw->yOff);
+ SectRgn(macDraw->clipRgn, macDraw->drawRgn, tkMacOSXtmpQdRgn);
+ OffsetRgn(macDraw->drawRgn, -macDraw->xOff, -macDraw->yOff);
}
- CGContextSetLineWidth(context, w);
- if (gc->line_style != LineSolid) {
- int num = 0;
- char *p = &(gc->dashes);
- double dashOffset = gc->dash_offset;
- float lengths[10];
-
- while (p[num] != '\0' && num < 10) {
- lengths[num] = p[num];
- num++;
+ ClipToGC(d, gc, NULL, tkMacOSXtmpQdRgn);
+ ClipCGContextToRegion(context, &portBounds, tkMacOSXtmpQdRgn);
+ SetEmptyRgn(tkMacOSXtmpQdRgn);
+ CGContextConcatCTM(context, CGAffineTransformMake(1.0, 0.0, 0.0,
+ -1.0, 0.0, portBounds.bottom - portBounds.top));
+ if (gc) {
+ double w = gc->line_width;
+
+ TkMacOSXSetColorInContext(gc->foreground, context);
+ if (port) {
+ CGContextSetPatternPhase(context,
+ CGSizeMake(portBounds.right - portBounds.left,
+ portBounds.bottom - portBounds.top));
+ }
+ if(gc->function != GXcopy) {
+ TkMacOSXDbgMsg("Logical functions other than GXcopy are "
+ "not supported for CG drawing!");
+ }
+ /* When should we antialias? */
+ if (notAA(gc->line_width)) {
+ /* Make non-antialiased CG drawing look more like X11 */
+ w -= (gc->line_width ? NON_AA_CG_OFFSET : 0);
+ CGContextSetShouldAntialias(context, 0);
+ } else {
+ CGContextSetShouldAntialias(context, 1);
+ }
+ CGContextSetLineWidth(context, w);
+ if (gc->line_style != LineSolid) {
+ int num = 0;
+ char *p = &(gc->dashes);
+ double dashOffset = gc->dash_offset;
+ float lengths[10];
+
+ while (p[num] != '\0' && num < 10) {
+ lengths[num] = p[num];
+ num++;
+ }
+ CGContextSetLineDash(context, dashOffset, lengths, num);
+ }
+ if (gc->cap_style == CapButt) {
+ /*
+ * What about CapNotLast, CapProjecting?
+ */
+
+ CGContextSetLineCap(context, kCGLineCapButt);
+ } else if (gc->cap_style == CapRound) {
+ CGContextSetLineCap(context, kCGLineCapRound);
+ } else if (gc->cap_style == CapProjecting) {
+ CGContextSetLineCap(context, kCGLineCapSquare);
+ }
+ if (gc->join_style == JoinMiter) {
+ CGContextSetLineJoin(context, kCGLineJoinMiter);
+ } else if (gc->join_style == JoinRound) {
+ CGContextSetLineJoin(context, kCGLineJoinRound);
+ } else if (gc->join_style == JoinBevel) {
+ CGContextSetLineJoin(context, kCGLineJoinBevel);
}
- CGContextSetLineDash(context, dashOffset, lengths, num);
- }
- if (gc->cap_style == CapButt) {
- /*
- * What about CapNotLast, CapProjecting?
- */
-
- CGContextSetLineCap(context, kCGLineCapButt);
- } else if (gc->cap_style == CapRound) {
- CGContextSetLineCap(context, kCGLineCapRound);
- } else if (gc->cap_style == CapProjecting) {
- CGContextSetLineCap(context, kCGLineCapSquare);
- }
- if (gc->join_style == JoinMiter) {
- CGContextSetLineJoin(context, kCGLineJoinMiter);
- } else if (gc->join_style == JoinRound) {
- CGContextSetLineJoin(context, kCGLineJoinRound);
- } else if (gc->join_style == JoinBevel) {
- CGContextSetLineJoin(context, kCGLineJoinBevel);
}
}
} else {
- PixPatHandle savePat = penPat;
-
- ChkErr(GetThemeDrawingState, &(dc->saveState));
- penPat = NULL;
- TkMacOSXSetUpGraphicsPort(gc, port);
- dc->penPat = penPat;
- penPat = savePat;
- if (gc) {
- TkMacOSXCheckTmpRgnEmpty(1);
- ClipToGC(d, gc, port, tkMacOSXtmpRgn1);
+ if (port) {
+ PixPatHandle savePat = penPat;
+
+ ChkErr(GetThemeDrawingState, &(dc->saveState));
+ penPat = NULL;
+ TkMacOSXSetUpGraphicsPort(gc, port);
+ dc->penPat = penPat;
+ penPat = savePat;
+ if (gc) {
+ TkMacOSXCheckTmpQdRgnEmpty();
+ ClipToGC(d, gc, port, tkMacOSXtmpQdRgn);
+ }
+ if (!tkPictureIsOpen) {
+ ShowPen();
+ }
}
- ShowPen();
}
dc->portBounds = portBounds;
dc->port = port;
@@ -1677,8 +1633,14 @@ TkMacOSXRestoreDrawingContext(TkMacOSXDrawingContext *dc)
ChkErr(QDEndCGContext, dc->port, &(dc->context));
}
} else {
- HidePen();
+ if (!tkPictureIsOpen) {
+ HidePen();
+ }
PenNormal();
+ if (dc->saveClip) {
+ SetPortClipRegion(dc->port, dc->saveClip);
+ DisposeRgn(dc->saveClip);
+ }
if (dc->penPat) {
DisposePixPat(dc->penPat);
}
@@ -1721,18 +1683,19 @@ TkMacOSXSetUpClippingRgn(
if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) {
TkMacOSXUpdateClipRgn(macDraw->winPtr);
#ifdef TK_MAC_DEBUG_DRAWING
- TkMacOSXDebugFlashRegion(port, macDraw->clipRgn);
+ TkMacOSXDbgMsg("%s clipRgn ", macDraw->winPtr->pathName);
+ TkMacOSXDebugFlashRegion(drawable, macDraw->clipRgn);
#endif /* TK_MAC_DEBUG_DRAWING */
}
if (macDraw->clipRgn) {
if (macDraw->flags & TK_CLIPPED_DRAW) {
- TkMacOSXCheckTmpRgnEmpty(1);
+ TkMacOSXCheckTmpQdRgnEmpty();
OffsetRgn(macDraw->drawRgn, macDraw->xOff, macDraw->yOff);
- SectRgn(macDraw->clipRgn, macDraw->drawRgn, tkMacOSXtmpRgn1);
+ SectRgn(macDraw->clipRgn, macDraw->drawRgn, tkMacOSXtmpQdRgn);
OffsetRgn(macDraw->drawRgn, -macDraw->xOff, -macDraw->yOff);
- SetPortClipRegion(port, tkMacOSXtmpRgn1);
- SetEmptyRgn(tkMacOSXtmpRgn1);
+ SetPortClipRegion(port, tkMacOSXtmpQdRgn);
+ SetEmptyRgn(tkMacOSXtmpQdRgn);
} else {
SetPortClipRegion(port, macDraw->clipRgn);
}
@@ -1849,7 +1812,7 @@ NoQDClip(
CGrafPtr port)
{
static RgnHandle noClipRgn = NULL;
-
+
if (!noClipRgn) {
noClipRgn = NewRgn();
SetRectRgn(noClipRgn, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX);
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index 5a4f063..19303e5 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -53,10 +53,10 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.2.2.11 2007/06/09 17:10:21 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.2.2.12 2007/06/29 03:22:01 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkMacOSXDefault.h"
#include "tkEntry.h"
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index 7afb933..e72a800 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -10,10 +10,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.3.2.14 2007/06/09 17:10:21 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.3.2.15 2007/06/29 03:22:02 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkMacOSXEvent.h"
#include "tkMacOSXDebug.h"
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 2cd3dda..94c2ade 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -12,10 +12,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXFont.c,v 1.3.2.9 2007/04/29 02:26:49 das Exp $
+ * RCS: @(#) $Id: tkMacOSXFont.c,v 1.3.2.10 2007/06/29 03:22:02 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#include "tkMacOSXFont.h"
#include "tclInt.h" /* for Tcl_CreateNamespace() */
@@ -257,7 +257,7 @@ static int GetFamilyOrAliasNum(const char *faceName, short *familyPtr);
static Tcl_Encoding GetFontEncoding(int faceNum, int allowSymbol, int *isSymbolPtr);
static Tk_Uid GetUtfFaceName(StringPtr faceNameStr);
static OSStatus GetThemeFontAndFamily(const ThemeFontID themeFontId,
- FMFontFamily* fontFamily, unsigned char *fontName, SInt16 *fontSize,
+ FMFontFamily *fontFamily, unsigned char *fontName, SInt16 *fontSize,
Style *fontStyle);
@@ -266,7 +266,7 @@ static OSStatus GetThemeFontAndFamily(const ThemeFontID themeFontId,
*
* TkpFontPkgInit --
*
- * This procedure is called when an application is created. It
+ * This procedure is called when an application is created. It
* initializes all the structures that are used by the
* platform-dependant code on a per application basis.
*
@@ -414,6 +414,7 @@ GetThemeFontAndFamily(
TkMacOSXDbgMsg("FMGetFontFamilyFromName failed.");
}
}
+
return err;
}
@@ -425,13 +426,13 @@ GetThemeFontAndFamily(
* Map a platform-specific native font name to a TkFont.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
+ * The return value is a pointer to a TkFont that represents the
* native font. If a native font by the given name could not be
* found, the return value is NULL.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the name has already been seen before. The caller should
- * call TkpDeleteFont() when the font is no longer needed.
+ * Every call to this procedure returns a new TkFont structure, even
+ * if the name has already been seen before. The caller should call
+ * TkpDeleteFont() when the font is no longer needed.
*
* The caller is responsible for initializing the memory associated
* with the generic TkFont when this function returns and releasing
@@ -480,19 +481,19 @@ TkpGetNativeFont(
*
* TkpGetFontFromAttributes --
*
- * Given a desired set of attributes for a font, find a font with
- * the closest matching attributes.
+ * Given a desired set of attributes for a font, find a font with the
+ * closest matching attributes.
*
* Results:
- * The return value is a pointer to a TkFont that represents the
- * font with the desired attributes. If a font with the desired
- * attributes could not be constructed, some other font will be
- * substituted automatically.
+ * The return value is a pointer to a TkFont that represents the font
+ * with the desired attributes. If a font with the desired attributes
+ * could not be constructed, some other font will be substituted
+ * automatically.
*
- * Every call to this procedure returns a new TkFont structure,
- * even if the specified attributes have already been seen before.
- * The caller should call TkpDeleteFont() to free the platform-
- * specific data when the font is no longer needed.
+ * Every call to this procedure returns a new TkFont structure, even
+ * if the specified attributes have already been seen before. The
+ * caller should call TkpDeleteFont() to free the platform- specific
+ * data when the font is no longer needed.
*
* The caller is responsible for initializing the memory associated
* with the generic TkFont when this function returns and releasing
@@ -503,13 +504,14 @@ TkpGetNativeFont(
*
*---------------------------------------------------------------------------
*/
+
TkFont *
TkpGetFontFromAttributes(
- TkFont *tkFontPtr, /* If non-NULL, store the information in
- * this existing TkFont structure, rather than
+ TkFont *tkFontPtr, /* If non-NULL, store the information in this
+ * existing TkFont structure, rather than
* allocating a new structure to hold the
* font; the existing contents of the font
- * will be released. If NULL, a new TkFont
+ * will be released. If NULL, a new TkFont
* structure is allocated. */
Tk_Window tkwin, /* For display where font will be used. */
CONST TkFontAttributes *faPtr)
@@ -580,15 +582,15 @@ found:
* TkpDeleteFont --
*
* Called to release a font allocated by TkpGetNativeFont() or
- * TkpGetFontFromAttributes(). The caller should have already
- * released the fields of the TkFont that are used exclusively by
- * the generic TkFont code.
+ * TkpGetFontFromAttributes(). The caller should have already
+ * released the fields of the TkFont that are used exclusively by the
+ * generic TkFont code.
*
* Results:
- * None.
+ * TkFont is deallocated.
*
* Side effects:
- * TkFont is deallocated.
+ * None.
*
*---------------------------------------------------------------------------
*/
@@ -597,10 +599,7 @@ void
TkpDeleteFont(
TkFont *tkFontPtr) /* Token of font to be deleted. */
{
- MacFont *fontPtr;
-
- fontPtr = (MacFont *) tkFontPtr;
- ReleaseFont(fontPtr);
+ ReleaseFont((MacFont *) tkFontPtr);
}
/*
@@ -608,8 +607,8 @@ TkpDeleteFont(
*
* TkpGetFontFamilies --
*
- * Return information about the font families that are available
- * on the display of the given window.
+ * Return information about the font families that are available on
+ * the display of the given window.
*
* Results:
* Modifies interp's result object to hold a list of all the available
@@ -645,8 +644,8 @@ TkpGetFontFamilies(
* screen fonts that make up a font object.
*
* Results:
- * Modifies interp's result object to hold a list containing the
- * names of the screen fonts that make up the given font object.
+ * Modifies interp's result object to hold a list containing the names
+ * of the screen fonts that make up the given font object.
*
* Side effects:
* None.
@@ -687,7 +686,7 @@ TkpGetSubFonts(
*
* Results:
* The return value is the number of bytes from source that
- * fit into the span that extends from 0 to maxLength. *lengthPtr is
+ * fit into the span that extends from 0 to maxLength. *lengthPtr is
* filled with the x-coordinate of the right edge of the last
* character that did fit.
*
@@ -1009,18 +1008,18 @@ Tk_DrawChars(
Display *display, /* Display on which to draw. */
Drawable drawable, /* Window or pixmap in which to draw. */
GC gc, /* Graphics context for drawing characters. */
- Tk_Font tkfont, /* Font in which characters will be drawn;
- * must be the same as font used in GC. */
- CONST char *source, /* UTF-8 string to be displayed. Need not be
- * '\0' terminated. All Tk meta-characters
+ Tk_Font tkfont, /* Font in which characters will be drawn; must
+ * be the same as font used in GC. */
+ CONST char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
* (tabs, control characters, and newlines)
* should be stripped out of the string that
- * is passed to this function. If they are
- * not stripped out, they will be displayed as
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
* regular printing characters. */
- int numBytes, /* Number of bytes in string. */
- int x, int y) /* Coordinates at which to place origin of
- * string when drawing. */
+ int numBytes, /* Number of bytes in string. */
+ int x, int y) /* Coordinates at which to place origin of the
+ * string when drawing. */
{
MacDrawable *macWin = (MacDrawable *) drawable;
MacFont *fontPtr = (MacFont *) tkfont;
@@ -2158,11 +2157,8 @@ TkMacOSXInitControlFontStyle(
MacFont *fontPtr = (MacFont *) tkfont;
FontFamily *lastFamilyPtr = fontPtr->subFontArray[0].familyPtr;
- fsPtr->flags =
- kControlUseFontMask|
- kControlUseSizeMask|
- kControlUseFaceMask|
- kControlUseJustMask;
+ fsPtr->flags = kControlUseFontMask | kControlUseSizeMask |
+ kControlUseFaceMask | kControlUseJustMask;
fsPtr->font = lastFamilyPtr->faceNum;
fsPtr->size = fontPtr->size;
fsPtr->style = fontPtr->style;
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index 0fc7a6e..89cfa0d 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -11,10 +11,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.5.2.10 2007/04/29 02:26:49 das Exp $
+ * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.5.2.11 2007/06/29 03:22:02 das Exp $
*/
-#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
/*
* This is a Tcl_Event structure that the Quit AppleEvent handler
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c