/* This file is part of tooldemo, a sample Tool plugin for Adobe Illustrator Copyright (C) 2002-5 Toby Thain, toby@telegraphics.com.au This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "common.h" AIToolHandle tool; AIPOINT p0,p1; AIErr addTool( SPInterfaceMessage *message ) { AIErr e = kNoErr; AIAddToolData toolData; toolData.title = toolData.tooltip = "Demo Tool"; toolData.icon = sADMIcon->GetFromResource ( message->d.self, ID_TOOL_ICON, 0); if ( ( sADMIcon->GetType( toolData.icon ) ) == kUnknown ) return kNoIconErr; toolData.sameGroupAs = toolData.sameToolsetAs = kNoTool; e = sTool->AddTool( message->d.self, toolData.title, &toolData, kToolWantsToTrackCursorOption, &tool ); return e; } AIErr toolOptions( AIToolMessage *message ) { return kNoErr; } AIErr toolTrackCursor( AIToolMessage *message ) { return kNoErr; } AIErr toolMouseDown( AIToolMessage *message ) { p0 = message->cursor; return kNoErr; } AIErr toolMouseDrag( AIToolMessage *message ) { AIErr e = kNoErr; if( !(e = acquire_suites(&message->d)) && !(e = sUndo->UndoChanges()) ){ p1 = message->cursor; e = plot_graph(&p0,&p1); } return e; } AIErr toolMouseUp( AIToolMessage *message ) { return kNoErr; } AIErr toolSelect( AIToolMessage *message ) { return kNoErr; } AIErr toolDeselect( AIToolMessage *message ) { return kNoErr; } AIErr toolValidate( AIToolMessage *message ) { return kNoErr; }