/* Copyright (c) 2004-2006 ActiveState Software Inc.
 * See the file LICENSE.txt for licensing information.
 *
 * Interfaces for Komodo's editor history backend.
 */

#include "nsISupports.idl"

interface koIView;
interface koIScintillaView;
interface ISciMoz;

[scriptable, uuid(589dbbf1-4366-4cf8-a542-c860d686050f)]
interface koIHistoryLocation : nsISupports
{
    attribute wstring uri;
    attribute unsigned long line;
    attribute unsigned long col;
    attribute wstring view_type;

    attribute long  marker_handle;
    attribute unsigned long window_num;
    attribute unsigned long tabbed_view_id;
    attribute wstring section_title;
    
    attribute wstring session_name;
};

/**
 * Callback interface for get_recent_locs
 */
[scriptable, function, uuid(442d1e53-cce2-4700-83d7-fa6354f850a3)]
interface koIHistoryGetLocationsCallback : nsISupports
{
    void onHaveLocations([array, size_is(count)] in koIHistoryLocation locs,
                         in unsigned long current_idx,
                         in unsigned long count);
};

/**
 * Callback interface for methods returning a single location
 */
[scriptable, function, uuid(7157dc13-dfc9-4cde-8c14-25270492b5d3)]
interface koIHistoryGetLocationCallback : nsISupports
{
    void onHaveLocation(in koIHistoryLocation locs);
};

[scriptable, uuid(5fac7c33-bed3-405e-8183-216a91e8a1b5)]
interface koIHistoryService : nsISupports
{
    boolean can_go_back(in wstring session_name);
    boolean can_go_forward(in wstring session_name);
    boolean have_recent_history(in wstring session_name);
    koIHistoryLocation go_back(in koIHistoryLocation curr_loc,
                               in unsigned long n,
                               in wstring session_name);
    koIHistoryLocation go_forward(in koIHistoryLocation curr_loc,
                                  in unsigned long n,
                                  in wstring session_name);
    koIHistoryLocation note_loc(in koIHistoryLocation loc,
                                in boolean check_section_change,
                                in koIScintillaView view);
    /**
     * Asynchronously note the current location of the given view
     */
    void note_curr_editor_loc(in koIScintillaView view);
    /**
     * Get a location from the given parameters
     */
    void loc_from_view_info(in ACString view_type,
                            in unsigned long window_num,
                            in unsigned long tabbed_view_id,
                            in koIView view,
                            in long pos,
                            in AString session_name,
                            in koIHistoryGetLocationCallback callback);
    void get_recent_locs(in koIHistoryLocation loc,
                         in AString session_name,
                         in koIHistoryGetLocationsCallback callback);
    void recent_uris_as_array(in unsigned long num_requested,
                              in wstring session_name,
                              [array, size_is(count)] out wstring uris,
                              out unsigned long count);
    void obsolete_uri(in wstring uri,
                      in unsigned long undo_delta,
                      in boolean undo_dir_is_back,
                      in wstring session_name);
    void update_marker_handles_on_close(in wstring uri, in ISciMoz scimoz);
};

// update
