Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
69e7f11a
Kaydet (Commit)
69e7f11a
authored
Şub 06, 2001
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added DlgObj_WhichDialog, analoguous to WhichWindow, and use this to get at dialogs.
üst
d6b2aeb1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
11 deletions
+107
-11
Dlgmodule.c
Mac/Modules/dlg/Dlgmodule.c
+47
-7
dlgsupport.py
Mac/Modules/dlg/dlgsupport.py
+60
-4
No files found.
Mac/Modules/dlg/Dlgmodule.c
Dosyayı görüntüle @
69e7f11a
...
...
@@ -30,7 +30,7 @@ static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
if
(
callback
==
NULL
)
return
0
;
/* Default behavior */
Dlg_FilterProc_callback
=
NULL
;
/* We'll restore it when call successful */
args
=
Py_BuildValue
(
"O&O&"
,
WinObj_WhichWindow
,
dialog
,
PyMac_BuildEventRecord
,
event
);
args
=
Py_BuildValue
(
"O&O&"
,
DlgObj_WhichDialog
,
dialog
,
PyMac_BuildEventRecord
,
event
);
if
(
args
==
NULL
)
res
=
NULL
;
else
{
...
...
@@ -81,7 +81,7 @@ static pascal void Dlg_UnivUserItemProc(DialogPtr dialog,
if
(
Dlg_UserItemProc_callback
==
NULL
)
return
;
/* Default behavior */
Dlg_FilterProc_callback
=
NULL
;
/* We'll restore it when call successful */
args
=
Py_BuildValue
(
"O&h"
,
WinObj_WhichWindow
,
dialog
,
item
);
args
=
Py_BuildValue
(
"O&h"
,
DlgObj_WhichDialog
,
dialog
,
item
);
if
(
args
==
NULL
)
res
=
NULL
;
else
{
...
...
@@ -96,7 +96,7 @@ static pascal void Dlg_UnivUserItemProc(DialogPtr dialog,
return
;
}
#if
1
#if
0
/*
** Treating DialogObjects as WindowObjects is (I think) illegal under Carbon.
** However, as they are still identical under MacOS9 Carbon this is a problem, even
...
...
@@ -922,7 +922,7 @@ static PyMethodDef DlgObj_methods[] = {
{
NULL
,
NULL
,
0
}
};
PyMethodChain
DlgObj_chain
=
{
DlgObj_methods
,
&
WinObj_chain
};
PyMethodChain
DlgObj_chain
=
{
DlgObj_methods
,
NULL
};
static
PyObject
*
DlgObj_getattr
(
self
,
name
)
DialogObject
*
self
;
...
...
@@ -933,11 +933,21 @@ static PyObject *DlgObj_getattr(self, name)
#define DlgObj_setattr NULL
#define DlgObj_compare NULL
static
int
DlgObj_compare
(
self
,
other
)
DialogObject
*
self
,
*
other
;
{
if
(
self
->
ob_itself
>
other
->
ob_itself
)
return
1
;
if
(
self
->
ob_itself
<
other
->
ob_itself
)
return
-
1
;
return
0
;
}
#define DlgObj_repr NULL
#define DlgObj_hash NULL
static
int
DlgObj_hash
(
self
)
DialogObject
*
self
;
{
return
(
int
)
self
->
ob_itself
;
}
PyTypeObject
Dialog_Type
=
{
PyObject_HEAD_INIT
(
&
PyType_Type
)
...
...
@@ -1107,7 +1117,7 @@ static PyObject *Dlg_DialogSelect(_self, _args)
&
itemHit
);
_res
=
Py_BuildValue
(
"bO&h"
,
_rv
,
WinObj_WhichWindow
,
theDialog
,
DlgObj_WhichDialog
,
theDialog
,
itemHit
);
return
_res
;
}
...
...
@@ -1463,6 +1473,36 @@ DlgObj_ConvertToWindow(self)
return
GetDialogWindow
(((
DialogObject
*
)
self
)
->
ob_itself
);
return
NULL
;
}
/* Return the object corresponding to the dialog, or None */
PyObject
*
DlgObj_WhichDialog
(
d
)
DialogPtr
d
;
{
PyObject
*
it
;
if
(
d
==
NULL
)
{
it
=
Py_None
;
Py_INCREF
(
it
);
}
else
{
WindowPtr
w
=
GetDialogWindow
(
d
);
it
=
(
PyObject
*
)
GetWRefCon
(
w
);
if
(
it
==
NULL
||
((
DialogObject
*
)
it
)
->
ob_itself
!=
d
||
!
DlgObj_Check
(
it
))
{
#if 0
/* Should do this, but we don't have an ob_freeit for dialogs yet. */
it = WinObj_New(w);
((WindowObject *)it)->ob_freeit = NULL;
#else
it
=
Py_None
;
Py_INCREF
(
it
);
#endif
}
else
{
Py_INCREF
(
it
);
}
}
return
it
;
}
void
initDlg
()
...
...
Mac/Modules/dlg/dlgsupport.py
Dosyayı görüntüle @
69e7f11a
...
...
@@ -53,7 +53,7 @@ static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
if (callback == NULL)
return 0; /* Default behavior */
Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
args = Py_BuildValue("O&O&",
WinObj_WhichWindow
, dialog, PyMac_BuildEventRecord, event);
args = Py_BuildValue("O&O&",
DlgObj_WhichDialog
, dialog, PyMac_BuildEventRecord, event);
if (args == NULL)
res = NULL;
else {
...
...
@@ -104,7 +104,7 @@ static pascal void Dlg_UnivUserItemProc(DialogPtr dialog,
if (Dlg_UserItemProc_callback == NULL)
return; /* Default behavior */
Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
args = Py_BuildValue("O&h",
WinObj_WhichWindow
, dialog, item);
args = Py_BuildValue("O&h",
DlgObj_WhichDialog
, dialog, item);
if (args == NULL)
res = NULL;
else {
...
...
@@ -119,7 +119,7 @@ static pascal void Dlg_UnivUserItemProc(DialogPtr dialog,
return;
}
#if
1
#if
0
/*
** Treating DialogObjects as WindowObjects is (I think) illegal under Carbon.
** However, as they are still identical under MacOS9 Carbon this is a problem, even
...
...
@@ -144,6 +144,36 @@ DlgObj_ConvertToWindow(self)
return GetDialogWindow(((DialogObject *)self)->ob_itself);
return NULL;
}
/* Return the object corresponding to the dialog, or None */
PyObject *
DlgObj_WhichDialog(d)
DialogPtr d;
{
PyObject *it;
if (d == NULL) {
it = Py_None;
Py_INCREF(it);
} else {
WindowPtr w = GetDialogWindow(d);
it = (PyObject *) GetWRefCon(w);
if (it == NULL || ((DialogObject *)it)->ob_itself != d || !DlgObj_Check(it)) {
#if 0
/* Should do this, but we don't have an ob_freeit for dialogs yet. */
it = WinObj_New(w);
((WindowObject *)it)->ob_freeit = NULL;
#else
it = Py_None;
Py_INCREF(it);
#endif
} else {
Py_INCREF(it);
}
}
return it;
}
"""
...
...
@@ -153,16 +183,42 @@ class MyObjectDefinition(GlobalObjectDefinition):
GlobalObjectDefinition
.
__init__
(
self
,
name
,
prefix
,
itselftype
)
## This won't work in Carbon, so we disable it for all MacPythons:-(
## But see the comment above:-((
self
.
basechain
=
"&WinObj_chain"
## self.basechain = "&WinObj_chain"
def
outputInitStructMembers
(
self
):
GlobalObjectDefinition
.
outputInitStructMembers
(
self
)
Output
(
"SetWRefCon(GetDialogWindow(itself), (long)it);"
)
def
outputCheckNewArg
(
self
):
Output
(
"if (itself == NULL) return Py_None;"
)
def
outputCheckConvertArg
(
self
):
Output
(
"if (v == Py_None) { *p_itself = NULL; return 1; }"
)
Output
(
"if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v);"
)
Output
(
" return 1; }"
)
def
outputCompare
(
self
):
Output
()
Output
(
"static int
%
s_compare(self, other)"
,
self
.
prefix
)
IndentLevel
()
Output
(
"
%
s *self, *other;"
,
self
.
objecttype
)
DedentLevel
()
OutLbrace
()
Output
(
"if ( self->ob_itself > other->ob_itself ) return 1;"
)
Output
(
"if ( self->ob_itself < other->ob_itself ) return -1;"
)
Output
(
"return 0;"
)
OutRbrace
()
def
outputHash
(
self
):
Output
()
Output
(
"static int
%
s_hash(self)"
,
self
.
prefix
)
IndentLevel
()
Output
(
"
%
s *self;"
,
self
.
objecttype
)
DedentLevel
()
OutLbrace
()
Output
(
"return (int)self->ob_itself;"
)
OutRbrace
()
def
outputFreeIt
(
self
,
itselfname
):
Output
(
"DisposeDialog(
%
s);"
,
itselfname
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment