/* Copyright 1998 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*----------------------------------------------------------------------*/
/*    Filename    : h.walkth                                            */
/*    Author	  : A.Rodger						*/
/*    Date        : Feb 1998						*/
/*    Source      : c++.DrawFile					*/
/*    Description : This is an extention to the file class              */
/*	with explicit instructions for drawing.				*/
/*    Modification history:      		       			*/
/*----------------------------------------------------------------------*/
#ifndef __walkth_h_
#define __walkth_h_

#include "kernel.h"
#include "wimp.h"
#include "window.h"
#include "main.h"
#include "menu.h"

#define BACKGROUND_COLOUR 0xFFFFFF00
#define TOOLBAR_HELP	69	// max size of the toolbar text excluding NULL

class stage
{

  public:
  BBox limits;
  char *help_text, *file_name;
  stage();
  ~stage();

  int  zero_area();
  void set_stage(char *text, int *counter, int max_val);
};

class ToolBar_Window: public Window
{
  DisplayField help_message;
  ActionButton print_button, skip_button, reverse_button;
  int number_of_stages, ok_button;

  public:
  int   stage_count;
  stage *stages;	// this will be an array

  void SetStages();
  int next_stage(int amount);

  void set_ok_button(void);
  ToolBar_Window();
  ~ToolBar_Window() {delete stages;}
  void Attach(ObjectId id);
  void SetHelpText(char *help_text);
  void DispatchEvent(ToolboxEvent *event, IdBlock *idb );
  void OnHasBeenHiddenEvent( WindowHasBeenHiddenEvent *has_been_hidden, IdBlock *idb );
};

class drawfile: public Window
{
  char *allocated_file, *file_name;
  int f_size, ratio[2];
  BBox w_extent;
  ToolBar_Window  toolbar;

  void set_identity_tran_matrix(int *matx);

  void set_A4_extent_with_zoom(void);
  int  file_size(char *s_filename);
  void file_load(char *s_filename);
  void load_new_file(char *s_filename);

  public:
  drawfile(void);			// allocates memory to the file
  ~drawfile(void);

  int next_stage(int amount);
  void zoom(int in_out);
  void redraw(void);
  _kernel_oserror *Render(int *matrix, BBox *extent);
  void request_print(void);
  void print_render(void);
  void print_abort(int job);

  void MessageHandler(WimpMessage *message);
  void OnHasBeenHiddenEvent( WindowHasBeenHiddenEvent *has_been_hidden, IdBlock *idb );
};

#endif
