// $Revision: 1.3 $ // Copyright (c) 1994-1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_SAMPLEWINDOWPROGRAM #include "SampleWindowProgram.h" #endif #ifndef Taligent_TEXTMODEL #include #endif #ifndef Taligent_TEXTVIEW #include #endif #ifndef Talignet_TEXTCOMMANDS #include #endif #ifndef Taligent_TEXTTOOLS #include #endif #ifndef Taligent_CURSORTOOLSELECTIONSTATE #include #endif #ifndef TaligentSamples_TEXTTOOLSAMPLE #include "TextToolSample.h" #endif int main(int argc, char* argv[]) { TSimpleTextStore store(TStandardText("Some inital sample text to edit.")); TSimpleTextView* view = new TSimpleTextView(&store); view->SetAllocatedArea(TGArea(TGRect(TGPoint::kOrigin, TGPoint(250, 150)))); TStandardText windowTitle(argv[0]); TStandardText menuTitle = windowTitle + TStandardText(" Menu"); //- TMenu* menu = new TMenu(); menu->SetControlLayout(MControl::kTopToBottom); menu->SetItemLayout(MControl::kLeftToRight); TStandardIBeamTool* ibeamTool = new TStandardIBeamTool; menu->AdoptLast(new TMomentaryMenuItem( new TCursorToolSelectionState(ibeamTool), new TTextLabel(TStandardText("Selection I-Beam Tool")))); const TRGBColor red(1, 0, 0); const TRGBColor green(0, 1, 0); const TRGBColor blue(0, 0, 1); const TRGBColor pink(1.0, 0.5, 0.5); TCommandOn* command = NIL; TSampleTextTool* tool = NIL; command = new TAddStylesCommand(TTextColorStyle(red)); tool = new TSampleTextTool(command, TSampleTextTool::CreateHighlighterGraphic(red)); menu->AdoptLast(new TMomentaryMenuItem( new TCursorToolSelectionState(tool), new TTextLabel(TStandardText("Red Text Tool")))); command = new TAddStylesCommand(TTextColorStyle(green)); tool = new TSampleTextTool(command, TSampleTextTool::CreateHighlighterGraphic(green)); menu->AdoptLast(new TMomentaryMenuItem( new TCursorToolSelectionState(tool), new TTextLabel(TStandardText("Green Text Tool")))); command = new TAddStylesCommand(TTextColorStyle(blue)); tool = new TSampleTextTool(command, TSampleTextTool::CreateHighlighterGraphic(blue)); menu->AdoptLast(new TMomentaryMenuItem( new TCursorToolSelectionState(tool), new TTextLabel(TStandardText("Blue Text Tool")))); command = new TRemoveStylesCommand(TTextColorStyle(pink)); // only style name significant here tool = new TSampleTextTool(command, TSampleTextTool::CreateEraserGraphic(pink)); menu->AdoptLast(new TMomentaryMenuItem( new TCursorToolSelectionState(tool), new TTextLabel(TStandardText("Color Eraser Tool")))); //- TSampleWindowProgram program(view, windowTitle, menu, menuTitle); program.Run(); return 0; }