import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
//import com.cicoe.note.paint.core.PanelManager


//fun initNote() {
//    PanelObjects.init()
////    File.unitTest()
//    Thread.init()
//    val page = Page()
//    PanelManager.openedPanels.add(panelManager)
////    page.manager = panelManager
////    page.setNoteInfo(panelManager.getNoteInfo())
//    val notePath = File.currentRootDirectory().absolutePath + "/../../note_test/a/1.ncc"
//////    val pagePath = File.currentRootDirectory().absolutePath + "/../../note_test/1.p"
////    val pagePath = File.currentRootDirectory().absolutePath + "/../note_test/s__res__/6.p"
////    page.pagePath = pagePath
////    page.load(pagePath)
////    page.setLoaded(true)
////    page.setLoadedInfo(true)
////    page.getPageInfo().type = NoteInfo.PageType.paper
////    page.getAllLayers().add(PageLayer())
////    panelManager.getNote().pages.add(page)
////    panelManager.newNoteLoad(panelManager, notePath, "")
//    val sharedPreferences = SharedPreferences("note")
//    val lastNote = sharedPreferences.getString("lastNote", "")
//    dbg("lastNote: ${lastNote}")
//    if (File(lastNote).exists()) {
//        panelManager.noteFileManager.restoreNote(lastNote, "")
//    } else {
//        panelManager.noteFileManager.newNote(NoteInfo.NoteType.infinite, notePath, null, true)
//            ?.let { note ->
//                panelManager.setNote(note)
//                panelManager.reRenderAll(true)
//                sharedPreferences.putString("lastNote", note.notePath)
//                sharedPreferences.save()
//            }
//    }
//    panelManager.setOnActionChangedListener(object : OnActionChangedListener {
//        override fun onActionChanged(manager: PanelManager, current: Int, pageIndex: Int) {
//            dbg("onActionChanged: ${manager.getNotePath()}")
//            manager.saveCurrentNote()
//        }
//
//    })
////    dbg("platform: ${com.newskyer.draw.Greeting().greet()}")
//    dbg("INIT: ${panelManager.getCurrentPage()}, ${panelManager.getCurrentPages().size}, ${panelManager.getCurrentPageIndex()}")
//    Utils.runInNewThread(200) {
//        panelManager.reDraw()
////        panelManager.getNote().notePath = "${File.currentRootDirectory().absolutePath}/../note_test/s.ncc"
////        panelManager.saveCurrentNote()
//    }
//}

fun main() = application {
    Window(onCloseRequest = ::exitApplication) {
        MainView()
    }
}