MLTE Control in power plant

MLTE Control in power plant

Post by vcma » Thu, 14 Oct 2004 16:23:53


I am new to power plant.
I have to use RTF control in my application.
I got the control MLTE but strugling for how to open the rtf file edited
in text edit in that control.
So anyone who is having any idea can pls help me.

Again when I am using the standard file open dialog the rtf file editd by
text edit is disabled how to enable it?

Thanks in advance.


-Hemant
 
 
 

MLTE Control in power plant

Post by vcma » Sun, 24 Oct 2004 14:20:31

Follwoing is the code for open dialog.

FSSpec filespec;
if(PP_StandardDialogs::AskChooseOneFile(ftRTFDocument,filespec,kNavDefaultNavDialogOptions,kNavSelectAllReadableItem)
{

}

But when it is opening the dialog, All RTF documents edited by textedit
are disable.
So where is a problem?
Can u pls explain?
Thanks

-Hemant

 
 
 

MLTE Control in power plant

Post by David Phil » Sun, 24 Oct 2004 14:41:30

In article
< XXXX@XXXXX.COM >,



Probably because Apple's TextEdit fails to set the file's 4-byte type
code to anything resembling 'RTF '. Apple's TextEdit just depends on the
last few characters of the filename being ".rtf". To find such files,
you'll need to write a function that filters based on the filename. You
might actually open the file and verify that the data fork starts with:

{\rtf
 
 
 

MLTE Control in power plant

Post by vcma » Tue, 26 Oct 2004 15:32:50

But here Data fork get filled after launching the file Open Dialog. In
file open dialog all rtf documents edited by text edit are disabled. So
how can I filter the filename.
Can u pls explain it in detail?

Thanks


-Hemant
 
 
 

MLTE Control in power plant

Post by David Phil » Wed, 27 Oct 2004 14:14:03

In article
< XXXX@XXXXX.COM >,



Here, I've written your program for you:

On my source code web page, < http://www.yqcomputer.com/ ;
I've put a PowerPlant project, MLTEDoc, with complete source code that
opens a RTF file into a LMLTEPane window.

Here's how you add a filter to PowerPlant's Open dialog box:



static pascal Boolean MyFilter(AEDesc *theItem, void * info, void *
/*callBackUD*/, NavFilterModes filterMode){
switch(filterMode){
case kNavFilteringBrowserList:
case kNavFilteringFavorites:
case kNavFilteringRecents:
return CanOpen(theItem,
reinterpret_cast<NavFileOrFolderInfo*>(info));
default:
return true;
}
return false;
}


void CDocumentApp::ChooseDocument(){
PP_StandardDialogs::LFileChooser chooser;

NavDialogOptions* options = chooser.GetDialogOptions();
if (options != nil) {
options->dialogOptionFlags = kNavDefaultNavDlogOptions
| kNavSelectAllReadableItem;
}
chooser.SetObjectFilterProc(MyFilter); // <- Notice
LFileTypeList fileTypeList(fileTypes_All);
if(chooser.AskOpenFile(fileTypeList)){
AEDescList docList;
chooser.GetFileDescList(docList);
SendAEOpenDocList(docList);
}
}

The complete source for "CanOpen" is in the example on my web site.
It handles the fact that Mac HFS+ filenames are really 16-bit per
character unicode, so you might like to filter by unicode suffixes.

I'll also submit it to the PowerPlant contributed class archives, but
don't hold your breath waiting for it to appear there.

I've also written a CUnicodeEditText control that is a drop in
replacement for LEditText: If you register it, instead of LEditText for
the signature 'etxt', then all your PPobs get my class instead of the
official LEditText. The advantage is that the new class uses Apple's
built in Control Manager Unicode Edit Control (not to be confused with
either MLTE or HITextView), so Unicode becomes as easy to work with for
editing as LStaticCaption makes it for static text.

I redefine GetDescriptor and SetDescriptor for my wrappers for LWindows,
and LAMControlImpl so that they assume they are working with UTF-8
strings, convert them to CFStrings, and pass them through PowerPlant's
CFString accessors. That way, all my old data files are suddenly Unicode
compatible, and even the 8-bit string manipulation in my app works right.
 
 
 

MLTE Control in power plant

Post by James W. W » Wed, 27 Oct 2004 15:45:30

In article
< XXXX@XXXXX.COM >, David



Me too, < http://www.yqcomputer.com/ ;.
 
 
 

MLTE Control in power plant

Post by vcma » Wed, 27 Oct 2004 21:16:58

Thanks I will try it.

-Hemant
 
 
 

MLTE Control in power plant

Post by vcma » Thu, 28 Oct 2004 20:24:19

Thanks for ur valuable guidance.
Filtering of rtf is working.
I have download ur MLTE code from ur site.
IT's zip file But some files in __MACOSX folder are . files
which are hidden. So I am unable to see those files.
So How to see those files?
Can u pls explain.
Thanks
-Hemant
 
 
 

MLTE Control in power plant

Post by James W. W » Fri, 29 Oct 2004 00:51:38

In article
< XXXX@XXXXX.COM >, vcmac



Use the OS X Finder, not StuffIt Expander, to unzip. The Finder uses a
special method to preserve resource forks.
 
 
 

MLTE Control in power plant

Post by vcma » Fri, 29 Oct 2004 18:44:31

Not Getting u.
Can u pls explain?

Again I have Mac machine having os MacOSX 1.3
So I am trying to open the RTF file in mlte control.
But my OS Doesn't support function TXNFlattenObjectToCFDataRef() or
TXNSetDataFromCFURLRef().
Because of the problem I mentioned, I couldn't see source code of you
people.
So Can u pls Suggest some alternative?

Thanks
-Hemant
 
 
 

MLTE Control in power plant

Post by David Phil » Sun, 07 Nov 2004 03:23:51

In article
< XXXX@XXXXX.COM >,




Since some people weren't able to cope with a Mac OS X archive file with
a .zip extension, I've replaced the above sample code with a .sit file.
That should cause fewer problems.
 
 
 

MLTE Control in power plant

Post by David Phil » Sun, 07 Nov 2004 03:50:19

In article <251020042345302945% XXXX@XXXXX.COM >,




James Walker did a great job, but he left out one minor point. I took
his code and edited it so that you can take an existing program, and
change one line in RegisterClasses() and get unicode aware edit controls
from all the LEditTexts in your existing PPobs. Constructor still thinks
they are LEditTexts, but at runtime they reanimate to CUnicodeEditTexts.

I've also incorporated Brett Wood's CMultipleUndoer class, so the
example has multiple undo in a multi-field dialog box: you can tab from
field to field making changes, then undo as many as many as you like,
with the focus moving back from field to field, then redo as many as you
like.

I've compiled it with 8.3 and with 9.3, and it appears to work with
either.

< http://www.yqcomputer.com/ ;

I'm a little annoyed with Apple: MLTE, as wrapped by LMLTEPane doesn't
give you support for the application's Services menu, but Apple's
EditUnicodeText control as wrapped by CUnicodeEditText does give you
support for the Services menu.

One tricky point: in PowerPlant, the destructor for LWindow destroys all
the subviews then one more layer of the onion is unwrapped and
LCommander's destructor is called, which calls LAttachable's destructor,
which destroys the LMultipleUndoer attachment. The LMultipleUndoer in
turn destroys its LArray of LActions, but the LActions refer to the
LPanes, so when the LAction tries to tell the LPane that the LAction is
going away, the LAction indirects through a dead pointer. Kaboom.

I fixed this by making the LActions LListeners, so they get notified
(msg_BroadcasterDied) when the corresponding LPane is dieing, so they
can set their reference to the LPane to NULL.

This allows either the LPane or the LAction to die first.
 
 
 

MLTE Control in power plant

Post by vcma » Tue, 09 Nov 2004 14:20:30

I have downloaded code for mlte.
It's opening now. But It's giving link error like,

Undefined UClassicDialogs::LFileChooser();
Undefined LStsScrollBarImp::TrackLinThumb
Undefined GetScrap().

I have included all header file as well as in setting also
I add path of all these file.But still it's giving link error.
Can u pls help me How to solve it?

Thanks

-Hemant
 
 
 

MLTE Control in power plant

Post by David Phil » Tue, 09 Nov 2004 17:24:32

In article
< XXXX@XXXXX.COM >,



What version of Codewarrior are you using? The project at
< http://www.yqcomputer.com/ ;,
< http://www.yqcomputer.com/ ; compiles for
me, both targets, under Metrowerks Codewarrior 9.3.